//==============================================================================
// The Society of Actuaries (SOA) makes this computer model and its computer
// code available to its members for educational purposes. The model and its
// code may be modified and redistributed without prior authorization from the
// SOA. The SOA distributes this computer model and its computer code 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.
//==============================================================================

package implementation;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class UserPanelTab_ProviderNetwork extends JPanel
{
	private static final long serialVersionUID = 5L;

	JLabel 	label_Title,
			label_A1, label_A2;
	JTextField 	component_A1, component_A2;
	
	public UserPanelTab_ProviderNetwork()
	{
		// Set the layout manager for the pane to be a "grid bag".
		// Grid bag is a flexible and easily modifiable layout format.		
		// (see: www.ugrad.cs.ubc.ca/~cs219/CourseNotes/Swing/swing-LayoutManagers-GridBag.html)
		// The Provider Network panel has two columns.
		GridBagLayout gridBagLayout = new GridBagLayout();
		setLayout(gridBagLayout);

		// Title label
		label_Title = new JLabel("<html><b><i>Detailed parameters for Provider Network agents</i></b><br>" +
                "<font color=\"blue\">(After making a change, be sure to press ENTER.)</font></html>");
		GridBagConstraints c = new GridBagConstraints();
		c.gridx 		= 0;
		c.gridy 		= 0;
		c.gridwidth 	= 1;
		c.gridheight 	= 1;
		c.weightx 		= 1.0;
		c.weighty 		= 1.0;
		c.anchor 		= GridBagConstraints.WEST;
		c.fill 			= GridBagConstraints.NONE;
		c.insets 		= new Insets(0,10,10,0);
		c.ipadx			= 0;
		c.ipady			= 0;
		gridBagLayout.setConstraints(label_Title, c);
		add(label_Title);


		// A1 label
		JLabel label_A1 = new JLabel("A1. Minimum alpha increase percent - Network A:");
		label_A1.setToolTipText("<html>Set the minimum percentage by which Provider Network A <br>" +
				"will increase the treatment cost alpha.</html>");
		c.gridx 		= 0;
		c.gridy 		= 1;
		c.gridwidth 	= 1;
		c.gridheight 	= 1;
		c.weightx 		= 1.0;
		c.weighty 		= 1.0;
		c.anchor 		= GridBagConstraints.EAST;
		c.fill 			= GridBagConstraints.NONE;
		c.insets 		= new Insets(0,0,0,10);
		c.ipadx			= 0;
		c.ipady			= 0;
		gridBagLayout.setConstraints(label_A1, c);
		add(label_A1);		
			
		// A1 component
		component_A1 = new JTextField(Double.toString(SimulationUserPanel.getMinimumAlphaIncreasePercent_NetworkA()), 10);
		component_A1.setToolTipText("<html>Set the minimum percentage by which Provider Network A <br>" +
				"will increase the treatment cost alpha.");
		c.gridx 		= 1;
		c.gridy 		= 1;
		c.gridwidth 	= 1;
		c.gridheight 	= 1;
		c.weightx 		= 1.0;
		c.weighty 		= 1.0;
		c.anchor 		= GridBagConstraints.WEST;
		c.fill 			= GridBagConstraints.HORIZONTAL;
		c.insets 		= new Insets(0,0,0,10);
		c.ipadx			= 0;
		c.ipady			= 0;
		gridBagLayout.setConstraints(component_A1, c);
		component_A1.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent event)
			{
				SimulationUserPanel.setMinimumAlphaIncreasePercent_NetworkA(
						Double.valueOf(component_A1.getText()));

				//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
				//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  					
//			     System.out.println("Provider Network A1. minimumAlphaIncreasePercent_NetworkA:  " +
//			    		 SimulationUserPanel.getMinimumAlphaIncreasePercent_NetworkA()); //Provider Network: A1
			    //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			    //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  	
			}//end actionPerformed()
		}
		);
		add(component_A1);	

		// A2 label
		JLabel label_A2 = new JLabel("A2. Minimum alpha increase percent - Network B:");
		label_A2.setToolTipText("<html>Set the minimum percentage by which Provider Network B <br>" +
				"will increase the treatment cost alpha.</html>");
		c.gridx 		= 0;
		c.gridy 		= 2;
		c.gridwidth 	= 1;
		c.gridheight 	= 1;
		c.weightx 		= 1.0;
		c.weighty 		= 1.0;
		c.anchor 		= GridBagConstraints.EAST;
		c.fill 			= GridBagConstraints.NONE;
		c.insets 		= new Insets(0,0,675,10);
		c.ipadx			= 0;
		c.ipady			= 0;
		gridBagLayout.setConstraints(label_A2, c);
		add(label_A2);		
			
		// A2 component
		component_A2 = new JTextField(Double.toString(SimulationUserPanel.getMinimumAlphaIncreasePercent_NetworkB()), 10);
		component_A2.setToolTipText("<html>Set the minimum percentage by which Provider Network B <br>" +
				"will increase the treatment cost alpha.");
		c.gridx 		= 1;
		c.gridy 		= 2;
		c.gridwidth 	= 1;
		c.gridheight 	= 1;
		c.weightx 		= 1.0;
		c.weighty 		= 1.0;
		c.anchor 		= GridBagConstraints.WEST;
		c.fill 			= GridBagConstraints.HORIZONTAL;
		c.insets 		= new Insets(0,0,675,10);
		c.ipadx			= 0;
		c.ipady			= 0;
		gridBagLayout.setConstraints(component_A2, c);
		component_A2.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent event)
			{
				SimulationUserPanel.setMinimumAlphaIncreasePercent_NetworkB(
						Double.valueOf(component_A2.getText()));

				//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
				//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  					
//			     System.out.println("Provider Network A2. minimumAlphaIncreasePercent_NetworkB:  " +
//			    		 SimulationUserPanel.getMinimumAlphaIncreasePercent_NetworkB()); //Provider Network: A2
			    //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			    //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  	
			}//end actionPerformed()
		}
		);
		add(component_A2);
		
	}//end UserPanelTab_ProviderNetwork()
	
}//end UserPanelTab_ProviderNetwork class
