JPnlAgk.java 3.6 KB
package org.emercit.components;

import java.awt.Color;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import java.awt.Image;
import java.awt.Font;
import org.emercit.model.*;
import javax.swing.UIManager;

public class JPnlAgk extends ExtPnlAgk {

	private class JPnlInfoExt extends ExtPnlInfo {

	}

	private int id;
	private JLabel lblTitleAgk = new JLabel();
	private JLabel lblTitleRiver = new JLabel();
	private JLabel lblTitleStatus = new JLabel();
	private JLabel lblTitleOpenDoor = new JLabel();
	private JLabel lblTitleRepair = new JLabel();
	private JLabel lblTitleVeracity = new JLabel();

	private JPnlInfoExt JPnlInfo = new JPnlInfoExt();

	public JPnlAgk(MdlEvent event) {

		setLayout(null);

		lblTitleAgk.setBounds(7, 47, 70, 15);
		lblTitleAgk.setText(event.getTitleAgk());
		// lblTitleAgk.setFont(new Font(null, Font.ITALIC, 14));
		lblTitleAgk.setFont(new Font(null, Font.BOLD, 14));
		lblTitleAgk.setForeground(Color.BLACK);

		add(lblTitleAgk);

		JPnlInfo.setLayout(null);
		JPnlInfo.setBounds(83, 7, 142, 88);

		// River

		lblTitleRiver.setText(event.getTitleRiver());
		lblTitleRiver.setForeground(Color.BLACK);

		if (event.getIdStatus() != 0 || event.getOpenDorr()
				|| event.getRepair() || !event.getVeracity()) {

			this.setYellow();
			if (event.getIdStatus() == 2)
				this.setRed();

			lblTitleRiver.setFont(new Font(null, Font.ITALIC, 12));
			lblTitleRiver.setBounds(3, 3, 138, 15);
			JPnlInfo.add(lblTitleRiver);

			/*
			 * ***************************STATUS***************************
			 */
			lblTitleStatus.setBounds(3, 18, 138, 15);
			lblTitleStatus.setFont(new Font(null, Font.ITALIC, 11));

			lblTitleStatus.setText("cтатус:" + event.getTitleStatus());
			lblTitleStatus.setForeground(event.getColorStatus());
			lblTitleStatus.setIcon(event.getIconStatusSmall());

			JPnlInfo.add(lblTitleStatus);

			// **********************************************************************************
			/*
			 * *****************************DOOR********************************
			 */
			lblTitleOpenDoor.setBounds(3, 34, 138, 15);
			lblTitleOpenDoor.setFont(new Font(null, Font.ITALIC, 11));

			lblTitleOpenDoor.setText(event.getTitleOpenDorr());
			lblTitleOpenDoor.setForeground(event.getColorOpenDoor());
			lblTitleOpenDoor.setIcon(event.getIconOpenDoorSmall());
			JPnlInfo.add(lblTitleOpenDoor);
			// ***************************************************************************

			/*
			 * *****************************REPAIR*******************************
			 * *
			 */

			lblTitleRepair.setBounds(3, 50, 138, 15);
			lblTitleRepair.setFont(new Font(null, Font.ITALIC, 11));

			lblTitleRepair.setText(event.getTitleRepair());
			lblTitleRepair.setForeground(event.getColorRepair());
			lblTitleRepair.setIcon(event.getIconRepairSmall());
			JPnlInfo.add(lblTitleRepair);

			// ***************************************************************************

			/*
			 * ******************************VERACITY****************************
			 * *********
			 */

			lblTitleVeracity.setBounds(3, 66, 138, 15);
			lblTitleVeracity.setFont(new Font(null, Font.ITALIC, 11));

			lblTitleVeracity.setText(event.getTitleVeracity());
			lblTitleVeracity.setForeground(event.getColorVeracity());
			lblTitleVeracity.setIcon(event.getIconVeracitySmall());
			JPnlInfo.add(lblTitleVeracity);

			// ****************************************************************************

			add(JPnlInfo);
		} else {

			this.setGreen();
			lblTitleRiver.setFont(new Font(null, Font.ITALIC, 14));
			lblTitleRiver.setBounds(83, 47, 138, 15);
			JPnlInfo.add(lblTitleRiver);
			add(lblTitleRiver);
		}

	}

}