it.txt.access.capability.revocation.wizard.panel.PanelRevocationData.java Source code

Java tutorial

Introduction

Here is the source code for it.txt.access.capability.revocation.wizard.panel.PanelRevocationData.java

Source

/*******************************************************************************
 * Copyright (c) 2011 - 2012 TXT e-solutions SpA
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * This work was performed within the IoT_at_Work Project
 * and partially funded by the European Commission's
 * 7th Framework Programme under the research area ICT-2009.1.3
 * Internet of Things and enterprise environments.
 *
 *
 * Authors:
 *     Cristoforo Seccia (TXT e-solutions SpA)
 *     Salvatore Piccione (TXT e-solutions SpA)
 *
 * Contributors:
 *      Domenico Rotondi (TXT e-solutions SpA)
 *******************************************************************************/
package it.txt.access.capability.revocation.wizard.panel;

import it.txt.access.capability.commons.filter.FilterXML;
import it.txt.access.capability.revocation.wizard.panel.controller.ControllerPanelRevocationData;
import it.txt.access.capability.revocation.wizard.panel.exception.PanelRevocationDataException;
import it.txt.access.capability.revocation.wizard.util.AuCapTokenLoader;
import it.txt.access.capability.schema.AccessRightsCapabilityType;

import java.awt.Frame;
import java.io.File;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;

import javax.swing.JFileChooser;
import javax.swing.JFormattedTextField;
import javax.swing.JTextField;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.filechooser.FileFilter;

import org.apache.commons.validator.routines.EmailValidator;

/**
 *
 * @author Cristoforo Seccia (TXT e-solutions SpA)
 * @author Salvatore Piccione (TXT e-solutions SpA - salvatore.piccione AT network.txtgroup.com)
 */
public class PanelRevocationData extends javax.swing.JPanel {

    private static final long serialVersionUID = 3891664502572702004L;
    private DateChooserDialog dialog_revoked_since_date = null;
    private DateChooserDialog dialog_revoked_aucap_issue_date = null;
    private Frame myContainer;
    private final String title;
    private JFileChooser auCapTokenChooser;
    private File currentAuCapTokenPath;
    private FileFilter filterAssertion;

    /** Creates new form WelcomePanel */
    public PanelRevocationData(String title, Frame container, ControllerPanelRevocationData cpatp) {
        this.title = title;
        initComponents();
        checkEditableTextBox(textbox_rev_issuer);
        checkEditableTextBox(textbox_rev_reason);
        checkFormattedTextBoxIsEmpty(textbox_revoked_since_datetime);
        checkFormattedTextBoxIsEmpty(textbox_revoked_since_time);
        checkEditableTextBox(textbox_notification_email);

        checkEditableTextBox(textbox_revoked_aucap_issuer);
        checkFormattedTextBoxIsEmpty(textbox_revoked_aucap_issue_datetime);
        checkFormattedTextBoxIsEmpty(textbox_revoked_aucap_issue_time);
        checkEditableTextBox(textbox_revoked_aucap_id);
        checkEditableTextBox(textbox_revoked_aucap_version);

        myContainer = container;
        dialog_revoked_since_date = new DateChooserDialog("Starting revocation date", myContainer, true);
        dialog_revoked_since_date.setLocale(Locale.UK);
        dialog_revoked_aucap_issue_date = new DateChooserDialog("Revoked capability issue date", myContainer, true);
        dialog_revoked_aucap_issue_date.setLocale(Locale.UK);

        filterAssertion = new FilterXML("Access Rights Capability");
        auCapTokenChooser = new JFileChooser();
        auCapTokenChooser.setFileFilter(filterAssertion);
        auCapTokenChooser.setMultiSelectionEnabled(false);

        //init file chooser
        if (currentAuCapTokenPath == null) {
            auCapTokenChooser.setCurrentDirectory(new File("."));
        } else {
            auCapTokenChooser.setCurrentDirectory(currentAuCapTokenPath);
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup_revoked_aucap_selection_mode = new javax.swing.ButtonGroup();
        buttonGroup_rev_scope = new javax.swing.ButtonGroup();
        centerPanel = new javax.swing.JPanel();
        centerTitlePanel = new javax.swing.JPanel();
        jSeparator1 = new javax.swing.JSeparator();
        welcomeLabel = new javax.swing.JLabel();
        policyIssuerLabel = new javax.swing.JLabel();
        policyAssigneeLabel = new javax.swing.JLabel();
        label_notification_email = new javax.swing.JLabel();
        textbox_rev_issuer = new javax.swing.JTextField();
        textbox_rev_reason = new javax.swing.JTextField();
        panel_revoked_aucap_identifying_data = new javax.swing.JPanel();
        label_revoked_aucap_issuer = new javax.swing.JLabel();
        label_revoked_aucap_issue_time = new javax.swing.JLabel();
        label_revoked_aucap_id = new javax.swing.JLabel();
        label_revoked_aucap_version = new javax.swing.JLabel();
        textbox_revoked_aucap_issuer = new javax.swing.JTextField();
        textbox_revoked_aucap_issue_time = new javax.swing.JFormattedTextField();
        button_revoked_aucap_issue_date = new javax.swing.JButton();
        textbox_revoked_aucap_issue_datetime = new javax.swing.JFormattedTextField();
        textbox_revoked_aucap_id = new javax.swing.JTextField();
        textbox_revoked_aucap_version = new javax.swing.JTextField();
        radioButton_file_upload = new javax.swing.JRadioButton();
        revoked_auCap_token_path = new javax.swing.JTextField();
        button_revoked_auCap_token_load = new javax.swing.JButton();
        radioButton_insert_data = new javax.swing.JRadioButton();
        jSeparator2 = new javax.swing.JSeparator();
        textbox_notification_email = new javax.swing.JTextField();
        label_revoked_since_time = new javax.swing.JLabel();
        textbox_revoked_since_datetime = new javax.swing.JFormattedTextField();
        button_revoked_since_date = new javax.swing.JButton();
        textbox_revoked_since_time = new javax.swing.JFormattedTextField();
        panel_revocation_scope = new javax.swing.JPanel();
        radioButton_selected_only_scope = new javax.swing.JRadioButton();
        radioButton_children_only_scope = new javax.swing.JRadioButton();
        radioButton_all_scope = new javax.swing.JRadioButton();
        label_requiredFieldLegenda = new javax.swing.JLabel();

        centerPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));

        centerTitlePanel.setBorder(javax.swing.BorderFactory.createTitledBorder(this.title));

        java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("bundles/PanelRevocationData"); // NOI18N
        welcomeLabel.setText(bundle.getString("subtitle")); // NOI18N

        policyIssuerLabel.setText(bundle.getString("capRevIssuerLabel")); // NOI18N

        policyAssigneeLabel.setText(bundle.getString("capRevReasonLabel")); // NOI18N

        label_notification_email.setText(bundle.getString("emailLabel")); // NOI18N

        textbox_rev_issuer.setToolTipText("Please insert the revocation issuer.");
        textbox_rev_issuer.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0)));
        textbox_rev_issuer.setMinimumSize(new java.awt.Dimension(6, 20));
        textbox_rev_issuer.setName("Revocation issuer");
        textbox_rev_issuer.setPreferredSize(new java.awt.Dimension(6, 20));

        textbox_rev_reason.setToolTipText(bundle.getString("capRevReasonTextBoxToolTip")); // NOI18N
        textbox_rev_reason.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0)));
        textbox_rev_reason.setMinimumSize(new java.awt.Dimension(30, 20));
        textbox_rev_reason.setName("Revocation reason");
        textbox_rev_reason.setPreferredSize(new java.awt.Dimension(30, 20));

        panel_revoked_aucap_identifying_data
                .setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("revokedAuCapDataLabel"))); // NOI18N
        panel_revoked_aucap_identifying_data.setToolTipText(bundle.getString("revokedDataPanelToolTip")); // NOI18N
        panel_revoked_aucap_identifying_data.setEnabled(false);

        label_revoked_aucap_issuer.setLabelFor(textbox_revoked_aucap_issuer);
        label_revoked_aucap_issuer.setText(bundle.getString("revokedAuCapIssuerLabel")); // NOI18N
        label_revoked_aucap_issuer.setEnabled(false);

        label_revoked_aucap_issue_time.setLabelFor(textbox_revoked_aucap_issue_datetime);
        label_revoked_aucap_issue_time.setText(bundle.getString("revokedAuCapIssueTimeLabel")); // NOI18N
        label_revoked_aucap_issue_time.setEnabled(false);

        label_revoked_aucap_id.setText(bundle.getString("revokedAuCapIDLabel")); // NOI18N
        label_revoked_aucap_id.setEnabled(false);

        label_revoked_aucap_version.setText(bundle.getString("revokedAuCapVersionLabel")); // NOI18N
        label_revoked_aucap_version.setEnabled(false);

        textbox_revoked_aucap_issuer.setEditable(false);
        textbox_revoked_aucap_issuer.setToolTipText(bundle.getString("revokedAuCapIssuerTextBoxToolTip")); // NOI18N
        textbox_revoked_aucap_issuer
                .setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0)));
        textbox_revoked_aucap_issuer.setMinimumSize(new java.awt.Dimension(30, 20));
        textbox_revoked_aucap_issuer.setName("Revoked capability issuer");
        textbox_revoked_aucap_issuer.setPreferredSize(new java.awt.Dimension(30, 20));

        textbox_revoked_aucap_issue_time
                .setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0)));
        textbox_revoked_aucap_issue_time.setEditable(false);
        textbox_revoked_aucap_issue_time.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(
                new javax.swing.text.DateFormatter(new java.text.SimpleDateFormat("HH:mm:ss.SSS Z"))));
        textbox_revoked_aucap_issue_time.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        textbox_revoked_aucap_issue_time.setToolTipText(bundle.getString("revokedAuCapIssueTimeTextBoxToolTip")); // NOI18N
        textbox_revoked_aucap_issue_time.setMinimumSize(new java.awt.Dimension(90, 20));
        textbox_revoked_aucap_issue_time.setName("Revoked capability issue time");
        textbox_revoked_aucap_issue_time.setPreferredSize(new java.awt.Dimension(100, 20));

        button_revoked_aucap_issue_date.setIcon(
                new javax.swing.ImageIcon(getClass().getResource("/images/icons_16x16/Calendar_16x16.png"))); // NOI18N
        button_revoked_aucap_issue_date.setText(bundle.getString("selectDateButton")); // NOI18N
        button_revoked_aucap_issue_date.setToolTipText(bundle.getString("revokedAuCapIssueDateButtonToolTip")); // NOI18N
        button_revoked_aucap_issue_date.setEnabled(false);
        button_revoked_aucap_issue_date.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                button_revoked_aucap_issue_dateActionPerformed(evt);
            }
        });

        textbox_revoked_aucap_issue_datetime
                .setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0)));
        textbox_revoked_aucap_issue_datetime.setEditable(false);
        textbox_revoked_aucap_issue_datetime.setFormatterFactory(
                new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(
                        java.text.DateFormat.getDateInstance(java.text.DateFormat.LONG))));
        textbox_revoked_aucap_issue_datetime.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        textbox_revoked_aucap_issue_datetime
                .setToolTipText(bundle.getString("revokedAuCapIssueDateTextBoxToolTip")); // NOI18N
        textbox_revoked_aucap_issue_datetime.setFocusable(false);
        textbox_revoked_aucap_issue_datetime.setMinimumSize(new java.awt.Dimension(90, 20));
        textbox_revoked_aucap_issue_datetime.setName("Revoked capability issue date");
        textbox_revoked_aucap_issue_datetime.setPreferredSize(new java.awt.Dimension(90, 20));

        textbox_revoked_aucap_id.setEditable(false);
        textbox_revoked_aucap_id.setToolTipText(bundle.getString("revokedAuCapIDTextBoxToolTip")); // NOI18N
        textbox_revoked_aucap_id
                .setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0)));
        textbox_revoked_aucap_id.setMinimumSize(new java.awt.Dimension(30, 20));
        textbox_revoked_aucap_id.setName("Revoked capability ID");
        textbox_revoked_aucap_id.setPreferredSize(new java.awt.Dimension(30, 20));

        textbox_revoked_aucap_version.setEditable(false);
        textbox_revoked_aucap_version.setToolTipText(bundle.getString("revokedAuCapVersionTextBoxToolTip")); // NOI18N
        textbox_revoked_aucap_version
                .setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0)));
        textbox_revoked_aucap_version.setMinimumSize(new java.awt.Dimension(30, 20));
        textbox_revoked_aucap_version.setName("Revoked capability version");
        textbox_revoked_aucap_version.setPreferredSize(new java.awt.Dimension(30, 20));

        buttonGroup_revoked_aucap_selection_mode.add(radioButton_file_upload);
        radioButton_file_upload.setSelected(true);
        radioButton_file_upload.setText(bundle.getString("loadFileRadioButtonLabel")); // NOI18N
        radioButton_file_upload.setToolTipText(bundle.getString("loadFileRadioButtonToolTip")); // NOI18N
        radioButton_file_upload.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radioButton_file_uploadActionPerformed(evt);
            }
        });

        revoked_auCap_token_path.setEditable(false);
        revoked_auCap_token_path.setToolTipText(bundle.getString("revokedAuCapPathToolTip")); // NOI18N
        revoked_auCap_token_path.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        revoked_auCap_token_path.setMinimumSize(new java.awt.Dimension(30, 20));
        revoked_auCap_token_path.setPreferredSize(new java.awt.Dimension(30, 20));

        button_revoked_auCap_token_load
                .setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icons_16x16/Open_16x16.png"))); // NOI18N
        button_revoked_auCap_token_load.setText(bundle.getString("loadRevokedAuCapButton")); // NOI18N
        button_revoked_auCap_token_load.setToolTipText(bundle.getString("loadRevokedAuCapButtonToolTip")); // NOI18N
        button_revoked_auCap_token_load.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                button_revoked_auCap_token_loadActionPerformed(evt);
            }
        });

        buttonGroup_revoked_aucap_selection_mode.add(radioButton_insert_data);
        radioButton_insert_data.setText(bundle.getString("insertDataRadioButtonLabel")); // NOI18N
        radioButton_insert_data.setToolTipText(bundle.getString("insertDataRadioButtonToolTip")); // NOI18N
        radioButton_insert_data.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radioButton_insert_dataActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panel_revoked_aucap_identifying_dataLayout = new javax.swing.GroupLayout(
                panel_revoked_aucap_identifying_data);
        panel_revoked_aucap_identifying_data.setLayout(panel_revoked_aucap_identifying_dataLayout);
        panel_revoked_aucap_identifying_dataLayout.setHorizontalGroup(panel_revoked_aucap_identifying_dataLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(panel_revoked_aucap_identifying_dataLayout.createSequentialGroup().addContainerGap()
                        .addGroup(panel_revoked_aucap_identifying_dataLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(panel_revoked_aucap_identifying_dataLayout.createSequentialGroup()
                                        .addGroup(panel_revoked_aucap_identifying_dataLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(label_revoked_aucap_id)
                                                .addComponent(label_revoked_aucap_version)
                                                .addComponent(label_revoked_aucap_issue_time)
                                                .addComponent(label_revoked_aucap_issuer)
                                                .addComponent(radioButton_file_upload))
                                        .addGap(38, 38, 38)
                                        .addGroup(panel_revoked_aucap_identifying_dataLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addGroup(panel_revoked_aucap_identifying_dataLayout
                                                        .createSequentialGroup()
                                                        .addComponent(revoked_auCap_token_path,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                Short.MAX_VALUE)
                                                        .addGap(5, 5, 5)
                                                        .addComponent(button_revoked_auCap_token_load))
                                                .addGroup(panel_revoked_aucap_identifying_dataLayout
                                                        .createSequentialGroup()
                                                        .addComponent(textbox_revoked_aucap_issue_datetime,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE, 208,
                                                                Short.MAX_VALUE)
                                                        .addPreferredGap(
                                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(button_revoked_aucap_issue_date,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 89,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addPreferredGap(
                                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(textbox_revoked_aucap_issue_time,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 97,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addComponent(textbox_revoked_aucap_id,
                                                        javax.swing.GroupLayout.Alignment.TRAILING,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(textbox_revoked_aucap_version,
                                                        javax.swing.GroupLayout.Alignment.TRAILING,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(textbox_revoked_aucap_issuer,
                                                        javax.swing.GroupLayout.Alignment.TRAILING,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                        .addGap(9, 9, 9))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                        panel_revoked_aucap_identifying_dataLayout.createSequentialGroup()
                                                .addComponent(jSeparator2).addContainerGap())
                                .addGroup(panel_revoked_aucap_identifying_dataLayout.createSequentialGroup()
                                        .addComponent(radioButton_insert_data,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 83,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addContainerGap()))));
        panel_revoked_aucap_identifying_dataLayout.setVerticalGroup(panel_revoked_aucap_identifying_dataLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(panel_revoked_aucap_identifying_dataLayout.createSequentialGroup()
                        .addGroup(panel_revoked_aucap_identifying_dataLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(radioButton_file_upload)
                                .addComponent(revoked_auCap_token_path, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(button_revoked_auCap_token_load))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(radioButton_insert_data)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 10, Short.MAX_VALUE)
                        .addGroup(panel_revoked_aucap_identifying_dataLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(label_revoked_aucap_issuer).addComponent(textbox_revoked_aucap_issuer,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(panel_revoked_aucap_identifying_dataLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(label_revoked_aucap_issue_time)
                                .addComponent(textbox_revoked_aucap_issue_datetime,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(textbox_revoked_aucap_issue_time,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(button_revoked_aucap_issue_date))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(panel_revoked_aucap_identifying_dataLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(label_revoked_aucap_id)
                                .addComponent(textbox_revoked_aucap_id, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(panel_revoked_aucap_identifying_dataLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(label_revoked_aucap_version)
                                .addComponent(textbox_revoked_aucap_version, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap()));

        textbox_notification_email.setToolTipText(bundle.getString("emailTextBoxToolTip")); // NOI18N
        textbox_notification_email
                .setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0)));
        textbox_notification_email.setMinimumSize(new java.awt.Dimension(30, 20));
        textbox_notification_email.setName("Notification e-mail");
        textbox_notification_email.setPreferredSize(new java.awt.Dimension(30, 20));

        label_revoked_since_time.setLabelFor(textbox_revoked_since_datetime);
        label_revoked_since_time.setText(bundle.getString("revokedSinceLabel")); // NOI18N

        textbox_revoked_since_datetime
                .setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0)));
        textbox_revoked_since_datetime.setEditable(false);
        textbox_revoked_since_datetime.setFormatterFactory(
                new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(
                        java.text.DateFormat.getDateInstance(java.text.DateFormat.LONG))));
        textbox_revoked_since_datetime.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        textbox_revoked_since_datetime.setToolTipText(bundle.getString("revokedSinceDateLabel")); // NOI18N
        textbox_revoked_since_datetime.setFocusable(false);
        textbox_revoked_since_datetime.setMinimumSize(new java.awt.Dimension(90, 20));
        textbox_revoked_since_datetime.setName("Revoked since date");
        textbox_revoked_since_datetime.setPreferredSize(new java.awt.Dimension(90, 20));

        button_revoked_since_date.setIcon(
                new javax.swing.ImageIcon(getClass().getResource("/images/icons_16x16/Calendar_16x16.png"))); // NOI18N
        button_revoked_since_date.setText(bundle.getString("selectDateButton")); // NOI18N
        button_revoked_since_date.setToolTipText(bundle.getString("revokedSinceDateButtonToolTip")); // NOI18N
        button_revoked_since_date.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                button_revoked_since_dateActionPerformed(evt);
            }
        });

        textbox_revoked_since_time
                .setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0)));
        textbox_revoked_since_time.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(
                new javax.swing.text.DateFormatter(new java.text.SimpleDateFormat("HH:mm:ss.SSS Z"))));
        textbox_revoked_since_time.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        textbox_revoked_since_time.setToolTipText(bundle.getString("revokedSinceTimeTextBoxToolTip")); // NOI18N
        textbox_revoked_since_time.setMinimumSize(new java.awt.Dimension(6, 5));
        textbox_revoked_since_time.setName("Revoked since time");
        textbox_revoked_since_time.setPreferredSize(new java.awt.Dimension(100, 20));

        panel_revocation_scope
                .setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("revScopeLabel"))); // NOI18N
        panel_revocation_scope.setToolTipText(bundle.getString("revScopeToolTip")); // NOI18N

        buttonGroup_rev_scope.add(radioButton_selected_only_scope);
        radioButton_selected_only_scope.setSelected(true);
        radioButton_selected_only_scope.setText(bundle.getString("revokeOnlySelectedAuCapRadioButtonLabel")); // NOI18N
        radioButton_selected_only_scope
                .setToolTipText(bundle.getString("revokeOnlySelectedAuCapRadioButtonToolTip")); // NOI18N

        buttonGroup_rev_scope.add(radioButton_children_only_scope);
        radioButton_children_only_scope.setText(bundle.getString("revokeOnlyChildrenAuCapRadioButtonLabel")); // NOI18N
        radioButton_children_only_scope
                .setToolTipText(bundle.getString("revokeOnlyChildrenAuCapRadioButtonToolTip")); // NOI18N

        buttonGroup_rev_scope.add(radioButton_all_scope);
        radioButton_all_scope.setText(bundle.getString("revAllSubtreeRadioButtonLabel")); // NOI18N
        radioButton_all_scope.setToolTipText(bundle.getString("revAllSubtreeRadioButtonToolTip")); // NOI18N

        javax.swing.GroupLayout panel_revocation_scopeLayout = new javax.swing.GroupLayout(panel_revocation_scope);
        panel_revocation_scope.setLayout(panel_revocation_scopeLayout);
        panel_revocation_scopeLayout.setHorizontalGroup(
                panel_revocation_scopeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(panel_revocation_scopeLayout.createSequentialGroup().addContainerGap()
                                .addComponent(radioButton_selected_only_scope).addGap(18, 18, 18)
                                .addComponent(radioButton_children_only_scope).addGap(18, 18, 18)
                                .addComponent(radioButton_all_scope)
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        panel_revocation_scopeLayout.setVerticalGroup(
                panel_revocation_scopeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                panel_revocation_scopeLayout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE)
                                        .addGroup(panel_revocation_scopeLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(radioButton_selected_only_scope)
                                                .addComponent(radioButton_children_only_scope)
                                                .addComponent(radioButton_all_scope))));

        label_requiredFieldLegenda.setText(bundle.getString("requiredFieldLegendaLabel")); // NOI18N

        javax.swing.GroupLayout centerTitlePanelLayout = new javax.swing.GroupLayout(centerTitlePanel);
        centerTitlePanel.setLayout(centerTitlePanelLayout);
        centerTitlePanelLayout.setHorizontalGroup(centerTitlePanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(centerTitlePanelLayout.createSequentialGroup().addContainerGap()
                        .addGroup(centerTitlePanelLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(welcomeLabel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jSeparator1)
                                .addComponent(panel_revoked_aucap_identifying_data,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE)
                                .addGroup(centerTitlePanelLayout.createSequentialGroup()
                                        .addGroup(centerTitlePanelLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(policyIssuerLabel).addComponent(policyAssigneeLabel)
                                                .addComponent(label_notification_email)
                                                .addComponent(label_revoked_since_time))
                                        .addGap(30, 30, 30)
                                        .addGroup(centerTitlePanelLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addGroup(centerTitlePanelLayout.createSequentialGroup()
                                                        .addComponent(textbox_revoked_since_datetime,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                Short.MAX_VALUE)
                                                        .addPreferredGap(
                                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(button_revoked_since_date)
                                                        .addPreferredGap(
                                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(textbox_revoked_since_time,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addComponent(textbox_rev_reason,
                                                        javax.swing.GroupLayout.Alignment.TRAILING,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(textbox_rev_issuer,
                                                        javax.swing.GroupLayout.Alignment.TRAILING,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(textbox_notification_email,
                                                        javax.swing.GroupLayout.Alignment.TRAILING,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                                .addComponent(panel_revocation_scope, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addGroup(centerTitlePanelLayout.createSequentialGroup()
                                        .addComponent(label_requiredFieldLegenda).addGap(0, 0, Short.MAX_VALUE)))
                        .addContainerGap()));
        centerTitlePanelLayout.setVerticalGroup(centerTitlePanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(centerTitlePanelLayout.createSequentialGroup().addContainerGap()
                        .addComponent(welcomeLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(14, 14, 14)
                        .addGroup(centerTitlePanelLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(textbox_rev_issuer, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(policyIssuerLabel))
                        .addGap(18, 18, 18)
                        .addGroup(centerTitlePanelLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(policyAssigneeLabel).addComponent(textbox_rev_reason,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(centerTitlePanelLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(label_revoked_since_time)
                                .addComponent(textbox_revoked_since_datetime,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(button_revoked_since_date).addComponent(textbox_revoked_since_time,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(centerTitlePanelLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(label_notification_email).addComponent(textbox_notification_email,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addComponent(panel_revoked_aucap_identifying_data, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(panel_revocation_scope, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED,
                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(label_requiredFieldLegenda).addContainerGap()));

        javax.swing.GroupLayout centerPanelLayout = new javax.swing.GroupLayout(centerPanel);
        centerPanel.setLayout(centerPanelLayout);
        centerPanelLayout.setHorizontalGroup(centerPanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(centerPanelLayout.createSequentialGroup().addContainerGap().addComponent(centerTitlePanel,
                        javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap()));
        centerPanelLayout.setVerticalGroup(centerPanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(centerPanelLayout.createSequentialGroup().addContainerGap().addComponent(centerTitlePanel,
                        javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap()));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(centerPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                        .addComponent(centerPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE)));
    }// </editor-fold>//GEN-END:initComponents

    private void button_revoked_aucap_issue_dateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button_revoked_aucap_issue_dateActionPerformed
        handlehandleShowDialog4RevokedAuCapIssueDate();
    }//GEN-LAST:event_button_revoked_aucap_issue_dateActionPerformed

    private void button_revoked_since_dateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button_revoked_since_dateActionPerformed
        handleShowDialog4RevokedSinceDate();
    }//GEN-LAST:event_button_revoked_since_dateActionPerformed

    private void button_revoked_auCap_token_loadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button_revoked_auCap_token_loadActionPerformed
        int returnValue = auCapTokenChooser.showOpenDialog(myContainer);
        if (returnValue == JFileChooser.APPROVE_OPTION) {
            File assertionFile = auCapTokenChooser.getSelectedFile();
            AccessRightsCapabilityType capability = AuCapTokenLoader.load(assertionFile, this);
            if (capability != null) {
                textbox_revoked_aucap_id.setText(capability.getAccessRightsCapabilityID());
                GregorianCalendar issueDateTime = capability.getIssueInstant().toGregorianCalendar();
                textbox_revoked_aucap_issue_datetime.setValue(issueDateTime.getTime());
                textbox_revoked_aucap_issue_time.setValue(issueDateTime.getTime());
                textbox_revoked_aucap_issuer.setText(capability.getIssuer().getValue());
                textbox_revoked_aucap_version.setText(capability.getVersion());
                revoked_auCap_token_path.setText(assertionFile.getAbsolutePath());
            }
        }
    }//GEN-LAST:event_button_revoked_auCap_token_loadActionPerformed

    private void radioButton_file_uploadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioButton_file_uploadActionPerformed
        //disable all insert data form fields
        textbox_revoked_aucap_issuer.setEditable(false);
        textbox_revoked_aucap_issuer.setFocusable(false);
        label_revoked_aucap_issuer.setEnabled(false);

        textbox_revoked_aucap_issue_datetime.setEditable(false);
        textbox_revoked_aucap_issue_datetime.setFocusable(false);
        textbox_revoked_aucap_issue_time.setEditable(false);
        textbox_revoked_aucap_issue_time.setFocusable(false);
        label_revoked_aucap_issue_time.setEnabled(false);
        button_revoked_aucap_issue_date.setEnabled(false);
        button_revoked_aucap_issue_date.setFocusable(false);

        textbox_revoked_aucap_id.setEditable(false);
        textbox_revoked_aucap_id.setFocusable(false);
        label_revoked_aucap_id.setEnabled(false);

        textbox_revoked_aucap_version.setEditable(false);
        textbox_revoked_aucap_version.setFocusable(false);
        label_revoked_aucap_version.setEnabled(false);

        //enable the textbox and the button for file loading
        button_revoked_auCap_token_load.setEnabled(true);

    }//GEN-LAST:event_radioButton_file_uploadActionPerformed

    private void radioButton_insert_dataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioButton_insert_dataActionPerformed
        //enable all insert data form fields
        textbox_revoked_aucap_issuer.setEditable(true);
        textbox_revoked_aucap_issuer.setFocusable(true);
        label_revoked_aucap_issuer.setEnabled(true);

        textbox_revoked_aucap_issue_time.setEditable(true);
        textbox_revoked_aucap_issue_time.setFocusable(true);
        label_revoked_aucap_issue_time.setEnabled(true);
        button_revoked_aucap_issue_date.setEnabled(true);
        button_revoked_aucap_issue_date.setFocusable(true);

        textbox_revoked_aucap_id.setEditable(true);
        textbox_revoked_aucap_id.setFocusable(true);
        label_revoked_aucap_id.setEnabled(true);

        textbox_revoked_aucap_version.setEditable(true);
        textbox_revoked_aucap_version.setFocusable(true);
        label_revoked_aucap_version.setEnabled(true);

        //disable the textbox and the button for file loading
        button_revoked_auCap_token_load.setEnabled(false);
    }//GEN-LAST:event_radioButton_insert_dataActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup_rev_scope;
    private javax.swing.ButtonGroup buttonGroup_revoked_aucap_selection_mode;
    private javax.swing.JButton button_revoked_auCap_token_load;
    private javax.swing.JButton button_revoked_aucap_issue_date;
    private javax.swing.JButton button_revoked_since_date;
    private javax.swing.JPanel centerPanel;
    private javax.swing.JPanel centerTitlePanel;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JLabel label_notification_email;
    private javax.swing.JLabel label_requiredFieldLegenda;
    private javax.swing.JLabel label_revoked_aucap_id;
    private javax.swing.JLabel label_revoked_aucap_issue_time;
    private javax.swing.JLabel label_revoked_aucap_issuer;
    private javax.swing.JLabel label_revoked_aucap_version;
    private javax.swing.JLabel label_revoked_since_time;
    private javax.swing.JPanel panel_revocation_scope;
    private javax.swing.JPanel panel_revoked_aucap_identifying_data;
    private javax.swing.JLabel policyAssigneeLabel;
    private javax.swing.JLabel policyIssuerLabel;
    private javax.swing.JRadioButton radioButton_all_scope;
    private javax.swing.JRadioButton radioButton_children_only_scope;
    private javax.swing.JRadioButton radioButton_file_upload;
    private javax.swing.JRadioButton radioButton_insert_data;
    private javax.swing.JRadioButton radioButton_selected_only_scope;
    private javax.swing.JTextField revoked_auCap_token_path;
    private javax.swing.JTextField textbox_notification_email;
    private javax.swing.JTextField textbox_rev_issuer;
    private javax.swing.JTextField textbox_rev_reason;
    private javax.swing.JTextField textbox_revoked_aucap_id;
    private javax.swing.JFormattedTextField textbox_revoked_aucap_issue_datetime;
    private javax.swing.JFormattedTextField textbox_revoked_aucap_issue_time;
    private javax.swing.JTextField textbox_revoked_aucap_issuer;
    private javax.swing.JTextField textbox_revoked_aucap_version;
    private javax.swing.JFormattedTextField textbox_revoked_since_datetime;
    private javax.swing.JFormattedTextField textbox_revoked_since_time;
    private javax.swing.JLabel welcomeLabel;
    // End of variables declaration//GEN-END:variables

    private void handleShowDialog4RevokedSinceDate() {
        dialog_revoked_since_date.setLocationRelativeTo(myContainer);
        dialog_revoked_since_date.setVisible(true);
        if (dialog_revoked_since_date.getReturnStatus() == DateChooserDialog.RET_OK) {
            textbox_revoked_since_datetime.setValue(dialog_revoked_since_date.getSelectedDate());
            textbox_revoked_since_time.setValue(dialog_revoked_since_date.getSelectedDate());
            dialog_revoked_aucap_issue_date.setMaxSelectableDate(dialog_revoked_since_date.getSelectedDate());
        }
    }

    private void handlehandleShowDialog4RevokedAuCapIssueDate() {
        dialog_revoked_aucap_issue_date.setLocationRelativeTo(myContainer);
        dialog_revoked_aucap_issue_date.setVisible(true);
        if (dialog_revoked_aucap_issue_date.getReturnStatus() == DateChooserDialog.RET_OK) {
            textbox_revoked_aucap_issue_time.setValue(dialog_revoked_aucap_issue_date.getSelectedDate());
            textbox_revoked_aucap_issue_datetime.setValue(dialog_revoked_aucap_issue_date.getSelectedDate());
            dialog_revoked_since_date.setMinSelectableDate(dialog_revoked_aucap_issue_date.getSelectedDate());
        }
    }

    private void checkEditableTextBox(final javax.swing.JTextField textBox) {

        textBox.getDocument().addDocumentListener(new DocumentListener() {

            public void insertUpdate(DocumentEvent e) {
                sorroundIssuerDocumentChange(e);
            }

            public void removeUpdate(DocumentEvent e) {
                sorroundIssuerDocumentChange(e);
            }

            public void changedUpdate(DocumentEvent e) {
                sorroundIssuerDocumentChange(e);
            }

            private void sorroundIssuerDocumentChange(DocumentEvent e) {
                if (textBox.getText().equals("")) {
                    textBox.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
                } else {
                    textBox.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0)));
                }
            }
        });
    }

    private void checkFormattedTextBoxIsEmpty(final JFormattedTextField textBox) {

        textBox.getDocument().addDocumentListener(new DocumentListener() {

            public void insertUpdate(DocumentEvent e) {
                changeBorderColor(e);
            }

            public void removeUpdate(DocumentEvent e) {
                changeBorderColor(e);
            }

            public void changedUpdate(DocumentEvent e) {
                changeBorderColor(e);
            }

            private void changeBorderColor(DocumentEvent e) {
                if (textBox.getValue() != null) {
                    textBox.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
                } else {
                    textBox.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0)));
                }

            }
        });
    }

    public void validateForm() throws PanelRevocationDataException {
        StringBuilder missingFields = new StringBuilder();
        StringBuilder invalidFields = new StringBuilder();

        isMissingTextField(textbox_rev_issuer, missingFields);
        isMissingTextField(textbox_rev_reason, missingFields);
        isMissingFormattedTextField(textbox_revoked_since_datetime, missingFields);
        isMissingFormattedTextField(textbox_revoked_since_time, missingFields);

        if (!isMissingTextField(textbox_notification_email, missingFields)) {
            if (!EmailValidator.getInstance().isValid(textbox_notification_email.getText())) {
                if (invalidFields.length() > 0)
                    invalidFields.append(", " + textbox_notification_email.getName());
                else
                    invalidFields.append(textbox_notification_email.getName());
            }
        }

        isMissingTextField(textbox_revoked_aucap_issuer, missingFields);
        isMissingFormattedTextField(textbox_revoked_aucap_issue_datetime, missingFields);
        isMissingFormattedTextField(textbox_revoked_aucap_issue_time, missingFields);
        isMissingTextField(textbox_revoked_aucap_id, missingFields);
        isMissingTextField(textbox_revoked_aucap_version, missingFields);

        StringBuilder errorMessage = new StringBuilder();
        if (missingFields.length() > 0) {
            missingFields.insert(0, "The following fields are empty:\n");
            errorMessage.append(missingFields);
        }
        if (invalidFields.length() > 0) {
            invalidFields.insert(0, "The following fields are not valid:\n");
            if (errorMessage.length() > 0)
                errorMessage.append("\n" + invalidFields);
            else
                errorMessage.append(invalidFields);
        }
        if (errorMessage.length() > 0)
            throw new PanelRevocationDataException(errorMessage.toString());
    }

    private boolean isMissingTextField(JTextField textBox, StringBuilder missingFieldMessage) {
        if (textBox.getText().equals("")) {
            if (missingFieldMessage.length() > 0)
                missingFieldMessage.append(", " + textBox.getName());
            else
                missingFieldMessage.append(textBox.getName());
            return true;
        }
        return false;
    }

    private boolean isMissingFormattedTextField(JFormattedTextField textBox, StringBuilder missingFieldMessage) {
        if (textBox.getValue() == null) {
            if (missingFieldMessage.length() > 0)
                missingFieldMessage.append(", " + textBox.getName());
            else
                missingFieldMessage.append(textBox.getName());
            return true;
        }
        return false;
    }

    public String getIssuer() {
        return textbox_rev_issuer.getText();
    }

    public String getReason() {
        return textbox_rev_reason.getText();
    }

    public String getNotificationEmail() {
        return textbox_notification_email.getText();
    }

    public Date getRevokedAuCapIssueDate() {
        return (Date) textbox_revoked_aucap_issue_datetime.getValue();
    }

    public Date getRevokedAuCapIssueTime() {
        return (Date) textbox_revoked_aucap_issue_time.getValue();
    }

    public Date getRevokedSinceDate() {
        return (Date) textbox_revoked_since_datetime.getValue();
    }

    public Date getRevokedSinceTime() {
        return (Date) textbox_revoked_since_time.getValue();
    }

    public void setMinSelectableDate(Date minSelectableDate) {
        dialog_revoked_since_date.setMinSelectableDate(minSelectableDate);
        dialog_revoked_aucap_issue_date.setMinSelectableDate(minSelectableDate);
    }

    public void setMaxSelectableDate(Date maxSelectableDate) {
        dialog_revoked_since_date.setMaxSelectableDate(maxSelectableDate);
        dialog_revoked_aucap_issue_date.setMaxSelectableDate(maxSelectableDate);
    }

    public boolean isRevScopeAllSelected() {
        return this.radioButton_all_scope.isSelected();
    }

    public boolean isRevScopeOnlySelectedAuCapSelected() {
        return this.radioButton_selected_only_scope.isSelected();
    }

    public boolean isRevScopeOnlyDependantAuCapsSelected() {
        return this.radioButton_children_only_scope.isSelected();
    }

    public void setIssuer(String issuer) {
        if (issuer == null) {
            this.textbox_rev_issuer.setEditable(true);
            this.textbox_rev_issuer.setFocusable(true);
            this.textbox_rev_issuer.requestFocus();
        } else {
            this.textbox_rev_issuer.setText(issuer);
            this.textbox_rev_issuer.setEditable(false);
            this.textbox_rev_issuer.setFocusable(false);
        }
    }

    /**
     * @return
     */
    public String getRevokedAuCapID() {
        return this.textbox_revoked_aucap_id.getText();
    }

    /**
     * @return
     */
    public String getRevokedAuCapIssuer() {
        return this.textbox_revoked_aucap_issuer.getText();
    }

    /**
     * @return
     */
    public String getRevokedAuCapVersion() {
        return this.textbox_revoked_aucap_version.getText();
    }
}