package widoco.gui;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author dgarijo
 */
public class TestStep0 extends javax.swing.JFrame {

	private final Logger logger = LoggerFactory.getLogger(this.getClass());

	/**
	 * Creates new form TestInterface
	 */
	public TestStep0() {
		initComponents();
		// set a transparent image
		Image icon = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB_PRE);
		this.setIconImage(icon);
		try {
			Image logo = ImageIO.read(ClassLoader.getSystemResource("logo/logo2.png"));
			Image l = logo.getScaledInstance(widocoLogo.getWidth(), widocoLogo.getHeight(), Image.SCALE_SMOOTH);
			widocoLogo.setIcon(new ImageIcon(l));
			widocoLogo.setText("");

			// loading scaled logos
			Image logoLeft = ImageIO.read(ClassLoader.getSystemResource("widoco/images/documentation.png"));
			this.labelPicLeft.setIcon(new ImageIcon(
					logoLeft.getScaledInstance(labelPicLeft.getWidth(), labelPicLeft.getHeight(), Image.SCALE_SMOOTH)));
			labelPicLeft.setText("");

			Image logoRight = ImageIO.read(ClassLoader.getSystemResource("widoco/images/landing.png"));
			this.labelPicRight.setIcon(new ImageIcon(logoRight.getScaledInstance(labelPicRight.getWidth(),
					labelPicRight.getHeight(), Image.SCALE_SMOOTH)));
			labelPicRight.setText("");
		} catch (IOException e) {
			logger.error("Error loading the logo :( " + e.getMessage());
		}

		this.labelDescriptionLeft.setVisible(false);
		this.labelDescriptionRight.setVisible(false);

		Dimension dim = java.awt.Toolkit.getDefaultToolkit().getScreenSize();

		// Determine the new location of the window
		int w = this.getSize().width;
		int h = this.getSize().height;
		int x = (dim.width - w) / 2;
		int y = (dim.height - h) / 2;

		// Move the window
		this.setLocation(x, y);

		// Image l =
		// g.getConfig().getWidocoLogo().getScaledInstance(widocoLogo.getWidth(),
		// widocoLogo.getHeight(), Image.SCALE_SMOOTH);

	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
	// <editor-fold defaultstate="collapsed" desc="Generated
	// Code">//GEN-BEGIN:initComponents
	private void initComponents() {

		backgroundPanel = new javax.swing.JPanel();
		leftPanel = new javax.swing.JPanel();
		labelTitleLeft = new javax.swing.JLabel();
		labelPicLeft = new javax.swing.JLabel();
		labelDescriptionLeft = new javax.swing.JLabel();
		panelTitle = new javax.swing.JPanel();
		widocoLogo = new javax.swing.JLabel();
		rightPanel = new javax.swing.JPanel();
		jLabel5 = new javax.swing.JLabel();
		labelPicRight = new javax.swing.JLabel();
		labelDescriptionRight = new javax.swing.JLabel();

		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
		setTitle("WIDOCO: A Wizard for documenting ontologies");
		setBackground(new java.awt.Color(255, 255, 255));
		setResizable(false);

		backgroundPanel.setBackground(new java.awt.Color(255, 255, 255));
		backgroundPanel.setPreferredSize(new java.awt.Dimension(1000, 500));

		leftPanel.setBackground(new java.awt.Color(255, 255, 255));
		leftPanel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
		leftPanel.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseEntered(java.awt.event.MouseEvent evt) {
				leftPanelMouseEntered(evt);
			}

			public void mouseExited(java.awt.event.MouseEvent evt) {
				leftPanelMouseExited(evt);
			}
		});

		labelTitleLeft.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
		labelTitleLeft.setText("Generate Documentation");

		labelPicLeft.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
		labelPicLeft.setText("Pic");

		labelDescriptionLeft.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
		labelDescriptionLeft.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
		labelDescriptionLeft.setText(
				"<html>Choose an ontology and <br/>\ngenerate its documentation in <br/>\none or multiple languages</html>");

		javax.swing.GroupLayout leftPanelLayout = new javax.swing.GroupLayout(leftPanel);
		leftPanel.setLayout(leftPanelLayout);
		leftPanelLayout.setHorizontalGroup(leftPanelLayout
				.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, leftPanelLayout.createSequentialGroup()
						.addGroup(leftPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
								.addGroup(leftPanelLayout.createSequentialGroup().addContainerGap().addComponent(
										labelPicLeft, javax.swing.GroupLayout.DEFAULT_SIZE,
										javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
								.addGroup(javax.swing.GroupLayout.Alignment.LEADING,
										leftPanelLayout.createSequentialGroup().addGap(25, 25, 25)
												.addComponent(labelTitleLeft).addGap(0, 18, Short.MAX_VALUE))
								.addComponent(labelDescriptionLeft))
						.addContainerGap()));
		leftPanelLayout
				.setVerticalGroup(
						leftPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
								.addGroup(leftPanelLayout.createSequentialGroup().addGap(30, 30, 30)
										.addComponent(labelTitleLeft, javax.swing.GroupLayout.DEFAULT_SIZE,
												javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
										.addGap(36, 36, 36)
										.addComponent(labelPicLeft, javax.swing.GroupLayout.PREFERRED_SIZE, 217,
												javax.swing.GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(labelDescriptionLeft, javax.swing.GroupLayout.PREFERRED_SIZE, 89,
												javax.swing.GroupLayout.PREFERRED_SIZE)
										.addGap(89, 89, 89)));

		panelTitle.setBackground(new java.awt.Color(255, 255, 255));

		widocoLogo.setText("LOGO");

		javax.swing.GroupLayout panelTitleLayout = new javax.swing.GroupLayout(panelTitle);
		panelTitle.setLayout(panelTitleLayout);
		panelTitleLayout
				.setHorizontalGroup(
						panelTitleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
								.addGroup(panelTitleLayout.createSequentialGroup().addGap(169, 169, 169)
										.addComponent(widocoLogo, javax.swing.GroupLayout.PREFERRED_SIZE, 190,
												javax.swing.GroupLayout.PREFERRED_SIZE)
										.addContainerGap(211, Short.MAX_VALUE)));
		panelTitleLayout.setVerticalGroup(
				panelTitleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
						javax.swing.GroupLayout.Alignment.TRAILING,
						panelTitleLayout.createSequentialGroup().addContainerGap()
								.addComponent(widocoLogo, javax.swing.GroupLayout.DEFAULT_SIZE, 64, Short.MAX_VALUE)
								.addContainerGap()));

		rightPanel.setBackground(new java.awt.Color(255, 255, 255));
		rightPanel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
		rightPanel.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseEntered(java.awt.event.MouseEvent evt) {
				rightPanelMouseEntered(evt);
			}

			public void mouseExited(java.awt.event.MouseEvent evt) {
				rightPanelMouseExited(evt);
			}
		});

		jLabel5.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
		jLabel5.setText("Generate Landing Page");

		labelPicRight.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
		labelPicRight.setText("Pic2");

		labelDescriptionRight.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
		labelDescriptionRight.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
		labelDescriptionRight
				.setText("<html>Generate an HTML overview<br/> for all the ontologies stored on <br/> a folder</html>");

		javax.swing.GroupLayout rightPanelLayout = new javax.swing.GroupLayout(rightPanel);
		rightPanel.setLayout(rightPanelLayout);
		rightPanelLayout.setHorizontalGroup(rightPanelLayout
				.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(rightPanelLayout.createSequentialGroup().addGroup(rightPanelLayout
						.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
						.addComponent(labelDescriptionRight, javax.swing.GroupLayout.DEFAULT_SIZE, 288, Short.MAX_VALUE)
						.addGroup(rightPanelLayout.createSequentialGroup().addContainerGap()
								.addGroup(rightPanelLayout
										.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
										.addGroup(rightPanelLayout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE)
												.addComponent(jLabel5).addGap(0, 0, Short.MAX_VALUE))
										.addComponent(labelPicRight, javax.swing.GroupLayout.Alignment.TRAILING,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
						.addContainerGap()));
		rightPanelLayout
				.setVerticalGroup(
						rightPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
								.addGroup(rightPanelLayout.createSequentialGroup().addGap(32, 32, 32)
										.addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE,
												javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
										.addGap(36, 36, 36)
										.addComponent(labelPicRight, javax.swing.GroupLayout.PREFERRED_SIZE, 217,
												javax.swing.GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(labelDescriptionRight, javax.swing.GroupLayout.PREFERRED_SIZE, 89,
												javax.swing.GroupLayout.PREFERRED_SIZE)
										.addGap(87, 87, 87)));

		javax.swing.GroupLayout backgroundPanelLayout = new javax.swing.GroupLayout(backgroundPanel);
		backgroundPanel.setLayout(backgroundPanelLayout);
		backgroundPanelLayout
				.setHorizontalGroup(backgroundPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
						.addComponent(panelTitle, javax.swing.GroupLayout.PREFERRED_SIZE,
								javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
						.addGroup(backgroundPanelLayout.createSequentialGroup()
								.addComponent(leftPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
										javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
								.addGap(0, 0, 0).addComponent(rightPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
										javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)));
		backgroundPanelLayout.setVerticalGroup(backgroundPanelLayout
				.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(backgroundPanelLayout.createSequentialGroup()
						.addComponent(panelTitle, javax.swing.GroupLayout.PREFERRED_SIZE,
								javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
						.addGroup(backgroundPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
								.addComponent(leftPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 410,
										javax.swing.GroupLayout.PREFERRED_SIZE)
								.addComponent(rightPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 410,
										javax.swing.GroupLayout.PREFERRED_SIZE))));

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addComponent(backgroundPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 570, Short.MAX_VALUE));
		layout.setVerticalGroup(
				layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(backgroundPanel,
						javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));

		pack();
	}// </editor-fold>//GEN-END:initComponents

	private void leftPanelMouseEntered(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_leftPanelMouseEntered
		Color c = new Color(240, 244, 252);
		this.leftPanel.setBackground(c);
		this.labelDescriptionLeft.setVisible(true);
	}// GEN-LAST:event_leftPanelMouseEntered

	private void leftPanelMouseExited(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_leftPanelMouseExited
		Color c = new Color(255, 255, 255);
		this.leftPanel.setBackground(c);
		this.labelDescriptionLeft.setVisible(false);
	}// GEN-LAST:event_leftPanelMouseExited

	private void rightPanelMouseEntered(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_rightPanelMouseEntered
		Color c = new Color(240, 244, 252);
		this.rightPanel.setBackground(c);
		this.labelDescriptionRight.setVisible(true);
	}// GEN-LAST:event_rightPanelMouseEntered

	private void rightPanelMouseExited(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_rightPanelMouseExited
		Color c = new Color(255, 255, 255);
		this.rightPanel.setBackground(c);
		this.labelDescriptionRight.setVisible(false);
	}// GEN-LAST:event_rightPanelMouseExited

	/**
	 * @param args
	 *            the command line arguments
	 */
	public static void main(String args[]) {
		/* Set the Nimbus look and feel */
		// <editor-fold defaultstate="collapsed" desc=" Look and feel setting code
		// (optional) ">
		/*
		 * If Nimbus (introduced in Java SE 6) is not available, stay with the default
		 * look and feel. For details see
		 * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
		 */
		try {
			for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
				if ("Nimbus".equals(info.getName())) {
					javax.swing.UIManager.setLookAndFeel(info.getClassName());
					break;
				}
			}
		} catch (ClassNotFoundException ex) {
			java.util.logging.Logger.getLogger(TestStep0.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
		} catch (InstantiationException ex) {
			java.util.logging.Logger.getLogger(TestStep0.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
		} catch (IllegalAccessException ex) {
			java.util.logging.Logger.getLogger(TestStep0.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
		} catch (javax.swing.UnsupportedLookAndFeelException ex) {
			java.util.logging.Logger.getLogger(TestStep0.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
		}
		// </editor-fold>
		// </editor-fold>

		/* Create and display the form */
		java.awt.EventQueue.invokeLater(new Runnable() {
			public void run() {
				new TestStep0().setVisible(true);
			}
		});
	}

	// Variables declaration - do not modify//GEN-BEGIN:variables
	private javax.swing.JPanel backgroundPanel;
	private javax.swing.JLabel jLabel5;
	private javax.swing.JLabel labelDescriptionLeft;
	private javax.swing.JLabel labelDescriptionRight;
	private javax.swing.JLabel labelPicLeft;
	private javax.swing.JLabel labelPicRight;
	private javax.swing.JLabel labelTitleLeft;
	private javax.swing.JPanel leftPanel;
	private javax.swing.JPanel panelTitle;
	private javax.swing.JPanel rightPanel;
	private javax.swing.JLabel widocoLogo;
	// End of variables declaration//GEN-END:variables
}
