<commit_before>/*******************************************************************************
 * Copyright (C) 2007 The University of Manchester   
 * 
 *  Modifications to the initial code base are copyright of their
 *  respective authors, or their employers as appropriate.
 * 
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public License
 *  as published by the Free Software Foundation; either version 2.1 of
 *  the License, or (at your option) any later version.
 *    
 *  This program is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *    
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 ******************************************************************************/
package net.sf.taverna.t2.workbench.ui.impl;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.ConnectException;
import java.net.MalformedURLException;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.Properties;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
//import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.border.Border;

import org.apache.commons.io.FileUtils;
import org.apache.log4j.Logger;

import net.sf.taverna.t2.lang.ui.DialogTextArea;
import net.sf.taverna.t2.workbench.icons.WorkbenchIcons;

@SuppressWarnings("serial")
public class UserRegistrationForm extends JDialog{

	public static String TAVERNA_VERSION_PROPERTY_NAME = "Taverna version";
	public static String FIRST_NAME_PROPERTY_NAME = "First name";
	public static String LAST_NAME_PROPERTY_NAME = "Last name";
	public static String EMAIL_ADDRESS_PROPERTY_NAME = "Email address";
	public static String INSTITUTION_OR_COMPANY_PROPERTY_NAME = "Institution or company name";
	public static String INDUSTRY_PROPERTY_NAME = "Industry";
	public static String FIELD_PROPERTY_NAME = "Field of investigation";
	public static String PURPOSE_PROPERTY_NAME = "Purpose of using Taverna";
	public static String KEEP_ME_INFORMED_PROPERTY_NAME = "Keep me informed by email";
	
	public static String TAVERNA_REGISTRATION_POST_PARAMETER_NAME = "taverna_registration";
	public static String TAVERNA_VERSION_POST_PARAMETER_NAME = "taverna_version";
	public static String FIRST_NAME_POST_PARAMETER_NAME = "first_name";
	public static String LAST_NAME_POST_PARAMETER_NAME = "last_name";
	public static String EMAIL_ADDRESS_POST_PARAMETER_NAME = "email";
	public static String INSTITUTION_OR_COMPANY_POST_PARAMETER_NAME = "institution_or_company";
	public static String INDUSTRY_TYPE_POST_PARAMETER_NAME = "industry_type";
	public static String FIELD_POST_PARAMETER_NAME = "field";
	public static String PURPOSE_POST_PARAMETER_NAME = "purpose";
	public static String KEEP_ME_INFORMED_POST_PARAMETER_PROPERTY_NAME = "keep_me_informed";
	
	private static String TRUE = Boolean.TRUE.toString();
	private static String FALSE = Boolean.FALSE.toString();

	private static String[] industryTypes = { "",
			"Academia - Life Sciences", "Academia - Social Sciences",
			"Academia - Physical Sciences",
			"Academia - Environmental Sciences", "Industry - Biotechnology",
			"Industry - Pharmaceutical", "Industry - Chemical",
			"Industry - Engineering", "Healthcare Services",
			"Goverment and Public Sector", "Other" };
	
	private Logger logger = Logger.getLogger(UserRegistrationForm.class);
	private UserRegistrationData previousRegistrationData;
	private JTextField firstNameTextField;
	private JTextField lastNameTextField;
	private JTextField emailTextField;
	private JCheckBox keepMeInformedCheckBox;
	private JTextField institutionOrCompanyTextField;
	private JComboBox industryTypeTextField;
	private JTextField fieldTextField;
	private JTextArea purposeTextArea;
	private JCheckBox termsAndConditionsCheckBox;

	
	public UserRegistrationForm(){
		super((Frame)null,"Taverna User Registration", true);
    	initComponents();
	}
	
	public UserRegistrationForm(File previousRegistrationDataFile) {
		super((Frame)null,"Taverna User Registration", true);
		previousRegistrationData = loadUserRegistrationData(previousRegistrationDataFile);
		initComponents();
	}

	private void initComponents() {
		setUndecorated(true);

		JPanel mainPanel = new JPanel((new GridBagLayout()));	<commit_msg>Changed possible industry types on the registration form.<commit_after>/*******************************************************************************
 * Copyright (C) 2007 The University of Manchester   
 * 
 *  Modifications to the initial code base are copyright of their
 *  respective authors, or their employers as appropriate.
 * 
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public License
 *  as published by the Free Software Foundation; either version 2.1 of
 *  the License, or (at your option) any later version.
 *    
 *  This program is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *    
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 ******************************************************************************/
package net.sf.taverna.t2.workbench.ui.impl;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.ConnectException;
import java.net.MalformedURLException;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.Properties;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
//import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.border.Border;

import org.apache.commons.io.FileUtils;
import org.apache.log4j.Logger;

import net.sf.taverna.t2.lang.ui.DialogTextArea;
import net.sf.taverna.t2.workbench.icons.WorkbenchIcons;

@SuppressWarnings("serial")
public class UserRegistrationForm extends JDialog{

	public static String TAVERNA_VERSION_PROPERTY_NAME = "Taverna version";
	public static String FIRST_NAME_PROPERTY_NAME = "First name";
	public static String LAST_NAME_PROPERTY_NAME = "Last name";
	public static String EMAIL_ADDRESS_PROPERTY_NAME = "Email address";
	public static String INSTITUTION_OR_COMPANY_PROPERTY_NAME = "Institution or company name";
	public static String INDUSTRY_PROPERTY_NAME = "Industry";
	public static String FIELD_PROPERTY_NAME = "Field of investigation";
	public static String PURPOSE_PROPERTY_NAME = "Purpose of using Taverna";
	public static String KEEP_ME_INFORMED_PROPERTY_NAME = "Keep me informed by email";
	
	public static String TAVERNA_REGISTRATION_POST_PARAMETER_NAME = "taverna_registration";
	public static String TAVERNA_VERSION_POST_PARAMETER_NAME = "taverna_version";
	public static String FIRST_NAME_POST_PARAMETER_NAME = "first_name";
	public static String LAST_NAME_POST_PARAMETER_NAME = "last_name";
	public static String EMAIL_ADDRESS_POST_PARAMETER_NAME = "email";
	public static String INSTITUTION_OR_COMPANY_POST_PARAMETER_NAME = "institution_or_company";
	public static String INDUSTRY_TYPE_POST_PARAMETER_NAME = "industry_type";
	public static String FIELD_POST_PARAMETER_NAME = "field";
	public static String PURPOSE_POST_PARAMETER_NAME = "purpose";
	public static String KEEP_ME_INFORMED_POST_PARAMETER_PROPERTY_NAME = "keep_me_informed";
	
	private static String TRUE = Boolean.TRUE.toString();
	private static String FALSE = Boolean.FALSE.toString();

	private static String[] industryTypes = { "",
			"Academia - Life Sciences", "Academia - Social Sciences",
			"Academia - Physical Sciences", "Academia - Environmental Sciences",
			"Academia - Other", "Industry - Biotechnology",
			"Industry - Pharmaceutical", "Industry - Engineering", 
			"Industry - Other", "Healthcare Services",
			"Goverment and Public Sector", "Other" };
	
	private Logger logger = Logger.getLogger(UserRegistrationForm.class);
	private UserRegistrationData previousRegistrationData;
	private JTextField firstNameTextField;
	private JTextField lastNameTextField;
	private JTextField emailTextField;
	private JCheckBox keepMeInformedCheckBox;
	private JTextField institutionOrCompanyTextField;
	private JComboBox industryTypeTextField;
	private JTextField fieldTextField;
	private JTextArea purposeTextArea;
	private JCheckBox termsAndConditionsCheckBox;

	
	public UserRegistrationForm(){
		super((Frame)null,"Taverna User Registration", true);
    	initComponents();
	}
	
	public UserRegistrationForm(File previousRegistrationDataFile) {
		super((Frame)null,"Taverna User Registration", true);
		previousRegistrationData = loadUserRegistrationData(previousRegistrationDataFile);
		initComponents();
	}

	public static void main(String[] args){
		UserRegistrationForm form = new UserRegistrationForm();
		form.setVisible(true);
	}
	
	private void initComponents() {
		setUndecorated(true);

		JPanel mainPanel = new JPanel((new GridBagLayout()));	
{'fraction_non_alphanumeric': 0.10369006924357962, 'fraction_numerical': 0.004207204838285564, 'mean_word_length': 6.004297114794352, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6893900', 'n_tokens_mistral': 3280, 'n_tokens_neox': 3177, 'n_words': 931}