/**
 * The MIT License
 *
 * Copyright (C) 2015 Asterios Raptis
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package io.github.astrapi69.swing.panels.help;

import io.github.astrapi69.model.BaseModel;
import io.github.astrapi69.model.api.Model;
import io.github.astrapi69.swing.base.BasePanel;

/**
 * Panel for a simple help with title and content.
 */
public class HelpPanel extends BasePanel<HelpModelBean>
{

	private javax.swing.JLabel lblHelpTitle;
	private javax.swing.JScrollPane scrHelpContent;
	private javax.swing.JTextPane txtHelpContent;

	public HelpPanel(final Model<HelpModelBean> model)
	{
		super(model);
	}

	/**
	 * Creates new form HelpPanel
	 */
	public HelpPanel()
	{
		this(BaseModel.of(HelpModelBean.builder().build()));
	}

	@Override
	protected void onInitializeComponents()
	{
		lblHelpTitle = new javax.swing.JLabel();
		scrHelpContent = new javax.swing.JScrollPane();
		txtHelpContent = new javax.swing.JTextPane();

		lblHelpTitle
			.setText(getModelObject().getTitle() != null ? getModelObject().getTitle() : "Help");
		txtHelpContent.setText(getModelObject().getContent() != null
			? getModelObject().getContent()
			: "No help content");

		scrHelpContent.setViewportView(txtHelpContent);
	}

	@Override
	protected void onInitializeLayout()
	{
		onInitializeGroupLayout();

	}

	protected void onInitializeGroupLayout()
	{
		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
		this.setLayout(layout);
		layout
			.setHorizontalGroup(
				layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
					.addGroup(layout.createSequentialGroup().addGap(32, 32, 32)
						.addGroup(layout
							.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
							.addComponent(scrHelpContent).addComponent(lblHelpTitle,
								javax.swing.GroupLayout.DEFAULT_SIZE, 740, Short.MAX_VALUE))
						.addContainerGap(28, Short.MAX_VALUE)));
		layout.setVerticalGroup(layout
			.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
			.addGroup(layout.createSequentialGroup().addGap(27, 27, 27)
				.addComponent(lblHelpTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 37,
					javax.swing.GroupLayout.PREFERRED_SIZE)
				.addGap(18, 18, 18)
				.addComponent(scrHelpContent, javax.swing.GroupLayout.PREFERRED_SIZE, 140,
					javax.swing.GroupLayout.PREFERRED_SIZE)
				.addContainerGap(25, Short.MAX_VALUE)));
	}

}

@@ -1508,16 +1508,60 @@
 sePanel;
+%0Aimport lombok.Getter;%0Aimport javax.swing.*;
 %0A%0A/**%0A *
@@ -1613,16 +1613,24 @@
 nt.%0A */%0A
+@Getter%0A
 public c
@@ -1689,28 +1689,16 @@
 private 
-javax.swing.
 JLabel l
@@ -1719,28 +1719,16 @@
 private 
-javax.swing.
 JScrollP
@@ -1756,28 +1756,16 @@
 private 
-javax.swing.
 JTextPan
@@ -2057,28 +2057,16 @@
 e = new 
-javax.swing.
 JLabel()
@@ -2090,28 +2090,16 @@
 t = new 
-javax.swing.
 JScrollP
@@ -2128,28 +2128,16 @@
 t = new 
-javax.swing.
 JTextPan
@@ -2368,16 +2368,52 @@
 ntent%22);
+%0A%09%09txtHelpContent.setEnabled(false);
 %0A%0A%09%09scrH
@@ -2592,28 +2592,16 @@
 ()%0A%09%7B%0A%09%09
-javax.swing.
 GroupLay
@@ -2617,28 +2617,16 @@
 t = new 
-javax.swing.
 GroupLay
@@ -2722,36 +2722,24 @@
 rallelGroup(
-javax.swing.
 GroupLayout.
@@ -2869,36 +2869,24 @@
 rallelGroup(
-javax.swing.
 GroupLayout.
@@ -2979,36 +2979,24 @@
 le,%0A%09%09%09%09%09%09%09%09
-javax.swing.
 GroupLayout.
@@ -3136,28 +3136,16 @@
 elGroup(
-javax.swing.
 GroupLay
@@ -3262,28 +3262,16 @@
 pTitle, 
-javax.swing.
 GroupLay
@@ -3295,36 +3295,24 @@
 E, 37,%0A%09%09%09%09%09
-javax.swing.
 GroupLayout.
@@ -3385,28 +3385,16 @@
 ontent, 
-javax.swing.
 GroupLay
@@ -3423,28 +3423,16 @@
 0,%0A%09%09%09%09%09
-javax.swing.
 GroupLay

disable help text field