package com.isensix.alerter;

/**
 * This class builds a basic GUI with a List area listing all current alerts
 * and a config area that is used to edit and add alerts. 
 */

import java.awt.EventQueue;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;

import java.util.ArrayList;

import javax.swing.event;
import javax.swing.event.ListSelectionEvent;

import javax.swing.JFrame;
import javax.swing.JList;

@SuppressWarnings("unused")
public class AlertSettings {

	private JFrame frame;
	private JList<String> list;
	private ArrayList<Alerts> alerts;

	/**
	 * Launch the application.

	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					AlertSettings window = new AlertSettings();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	} */

	/**
	 * Create the application.
	 */
	public AlertSettings(ArrayList<Alerts> al) {
		alerts = al;
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {

		GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
		int monWidth = gd.getDisplayMode().getWidth();
		int monHeight = gd.getDisplayMode().getHeight();

		int winWidth = 450;
		int winHeight = 300;

		frame = new JFrame();
		frame.setBounds(((monWidth/2)-(winWidth/2)), ((monHeight/2)-(winHeight/2)), // center window
		 	winWidth, winHeight); // size windowIa
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		this.buildList();

	}

	private void buildList() {
		list = new JList<String>();
		list.addListSelectionListener(new ListSelectionListiner(){
			public valueChanged(ListSelectionEvent e) {
				changeConfig();
			}
		});
	}

	private void changeConfig() {
		// TODO Change config area to match selected alert
	}

	private void builtConfig() {
		// TODO Layout the config area
	}

	private void addAlert() {
		// TODO import data from config area to create a new alert, and add to list
	}

}

@@ -165,10 +165,9 @@
 rts.
- 
 %0A
+
  */%0A
@@ -259,24 +259,50 @@
 Environment;
+%0Aimport java.awt.Checkbox;
 %0A%0Aimport jav
@@ -444,16 +444,134 @@
 g.JList;
+%0Aimport javax.swing.JLabel;%0Aimport javax.swing.JButton;%0Aimport javax.swing.JTextField;%0Aimport javax.swing.GroupLayout;
 %0A%0A@Suppr
@@ -622,16 +622,51 @@
 ings %7B%0A%0A
+%09// Define classes that can change%0A
 %09private
@@ -743,16 +743,571 @@
  alerts;
+%0A%09private GroupLayout layout;%0A%09private Checkbox%5B%5D dayCheck;%0A%09private JButton add;%0A%09private JTextField messageBox;%0A%09private JTextField timeBox;%0A%0A%09// Define final values%0A%09private final JLabel aLabel = new JLabel(%22Alerts%22);%0A%09private final JLabel mLabel = new JLabel(%22Messages%22);%0A%09private final JLabel%5B%5D dayLabel = %5Bnew JLabel(%22M%22),%0A%09%09new JLabel(%22Tu%22), new JLabel(%22W%22), new JLabel(%22Tr%22),%0A%09%09new JLabel(%22F%22), new JLabel(%22Sa%22), new JLabel(%22Su%22)%5D;%0A%09private final JLabel%5B%5D timeLabel = %5Bnew JLabel(%22Time%22),%0A%09%09new JLabel(%22am%22), new JLabel(%22pm%22), new JLabel(%2224hr%22)%5D;
 %0A%0A%09/**%0A%09
@@ -2491,24 +2491,24 @@
 fig();%0A%09%09%09%7D%0A
-
 %09%09%7D);%0A%09%7D%0A%0A%09p
@@ -2501,24 +2501,110 @@
 %7D%0A%09%09%7D);%0A%09%7D%0A%0A
+%09private GridLayout buildGridLayout() %7B%0A%09%09// TODO Build the layout%0A%09%09return null;%0A%09%7D%0A%0A
 %09private voi

Add Variables