package com.ui;

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

import com.Context;
//import com.serial.Serial;

/**
 * @author Chris Park @ Infinetix Corp.
 * Date: 1-26-21
 * Description: Dashboard Widget child class used to display contextual vehicle 
 * information in an easy to interpret visual format. Example use cases would be
 * displaying a units current decision state, or perhaps a visual warning level
 * indication related to a vehicle sensor or other data processing part over
 * serial communication.
 */
public class StatusBarWidget extends JPanel {
	
	//Constants
	protected static final int MIN_BAR_WIDTH	= 100;
	protected static final int BAR_HEIGHT 		= 25;
	
	protected String barType;
	protected JLabel statusLabel;
	
	//Class Constructor
	public StatusBarWidget(Context ctx, String type) {
		
		barType = type;
		statusLabel.setText("Undefined");
		statusLabel.setBackground(Color.white);
		
		statusLabel.setMinimumSize(new Dimension(MIN_BAR_WIDTH, BAR_HEIGHT));
		statusLabel.setPreferredSize(new Dimension(MIN_BAR_WIDTH, BAR_HEIGHT));
	}
	
	/**
	 * Updates the status bar text display to the given string parameter.
	 * @param text - The text to update the label to.
	 */
	public void setLabel(String text) {
		statusLabel.setText(text);
	}
	
	/**
	 * Updates the status bar background color to the given Color parameter
	 * @param color - The color to set the background do
	 */
	public void setColor(Color color) {
		statusLabel.setBackground(color);
	}
	
	/**
	 * Updates the preferred size of the status bar
	 * @param size - the Dimensional size (Width, Height) to set the bar to.
	 */
	public void setSize(Dimension size) {
		statusLabel.setPreferredSize(size);
	}
}

@@ -719,33 +719,27 @@
 %0A%09%0A%09
-protected String barType;
+//Bar Display Label
 %0A%09pr
@@ -768,16 +768,484 @@
 abel;%0A%09%0A
+%09/**%0A%09 * Pre-define status type enums used to more concisely track%0A%09 * status bar parameters by type and allow for easier updating.%0A%09 */%0A%09public enum StatusType %7B%0A%09%09NORMAL%09%09(%22Normal%22, %09Color.white), %0A%09%09PROCESSING%09(%22Process%22, Color.blue), %0A%09%09CAUTION%09%09(%22Caution%22, Color.yellow),%0A%09%09ERROR%09%09(%22Error%22, %09Color.red);%0A%09%09%0A%09%09private final String text;%0A%09%09private final Color color;%0A%09%09%0A%09%09StatusType(String text, Color color) %7B%0A%09%09%09this.text = text;%0A%09%09%09this.color = color;%0A%09%09%7D%0A%09%7D;%0A%09%0A
 %09//Class
@@ -1313,29 +1313,8 @@
 ) %7B%0A
-%09%09%0A%09%09barType = type;%0A
 %09%09st
@@ -1546,632 +1546,118 @@
 %0A%09%0A%09
-/**%0A%09 * Updates the status bar text display to the given string parameter.%0A%09 * @param text - The text to update the label to.%0A%09 */%0A%09public void setLabel(String text) %7B%0A%09%09statusLabel.setText(text);%0A%09%7D%0A%09%0A%09/**%0A%09 * Updates the status bar background color to the given Color parameter%0A%09 * @param color - The color to set the background do%0A%09 */%0A%09public void setColor(Color color) %7B%0A%09%09statusLabel.setBackground(color);%0A%09%7D%0A%09%0A%09/**%0A%09 * Updates the preferred size of the status bar%0A%09 * @param size - the Dimensional size (Width, Height) to set the bar to.%0A%09 */%0A%09public void setSize(Dimension size) %7B%0A%09%09statusLabel.setPreferredSize(size
+public void update(StatusType type) %7B%0A%09%09statusLabel.setText(type.text);%0A%09%09statusLabel.setBackground(type.color
 );%0A%09

Add StateType enums