/*
 Tiamat - a role-playing game framework
 WelcomePanel.java - displays welcome information for the Adventure Studio
 
 Copyright  (C) 2006 Hugues Johnson
 
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
 the GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

package com.huguesjohnson.tiamat.tools.adventureStudio;

import java.net.URL;

import javax.swing.BoxLayout;
import javax.swing.JEditorPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

/**  WelcomePanel - displays welcome information for the Adventure Studio
 * @author Hugues Johnson
 */
public abstract class WelcomePanel extends JPanel{
	/* Determines if a de-serialized file is compatible with this class. See <a href="http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/class.html">Java Object Serialization Specifications</a>. */
	private static final long serialVersionUID=8190084474624573574L;
	
	public WelcomePanel(){
	    this.initComponents();
	}
	
	private void initComponents(){
		//set the layout
		this.setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
		//display the welcome message
		JEditorPane editorPane=new JEditorPane();
		editorPane.setEditable(false);
		URL url=this.getClass().getResource("/com/huguesjohnson/tiamat/tools/adventureStudio/welcome.html");
		if(url!=null){
		    try{
		    	editorPane.setPage(url);
		    } catch(Exception x){
		        editorPane.setText("Error reading welcome.html\n\n"+x.getMessage());
		    }
		} else{
	        editorPane.setText("Can't find resource /com/huguesjohnson/tiamat/tools/adventureStudio/welcome.html");
		}
		JScrollPane scrollPane=new JScrollPane(editorPane);
		this.add(scrollPane);
		//add a panel for 
	}
	
	//override in implementing class
	public abstract void onNewButtonPressed();
	public abstract void onOpenButtonPressed();
}