// ExamplePanel.java
//
// Created: February 2006
//
// This file is a component of the BioMoby project.
// Copyright Martin Senger (martin.senger@gmail.com).
//

package org.biomoby.service.dashboard;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JComponent;
import javax.swing.BoxLayout;

import java.awt.Font;

/**
 * A tutorial panel. <p>
 *
 * @author <A HREF="mailto:martin.senger@gmail.com">Martin Senger</A>
 * @version $Id: ExamplePanel.java,v 1.1 2006/02/19 18:42:55 senger Exp $
 */

public class ExamplePanel
    extends AbstractPanel {

    // associated model working behind the scene
    RegistryModel registryModel;

    /*********************************************************************
     * Default constructor.
     ********************************************************************/
    public ExamplePanel() {
	super();
	panelIconFileName = "images/smallTutorial.gif";
    }

    /**************************************************************************
     *
     **************************************************************************/
    public JComponent getComponent (PropertyChannel aPropertyChannel) {
 	setPropertyChannel (aPropertyChannel);
	registryModel = createRegistryModel();

	if (pComponent != null) return pComponent;
	pComponent = new JPanel();
	pComponent.setLayout (new BoxLayout (pComponent, BoxLayout.Y_AXIS));

	JLabel label = new JLabel ("This is a Tutorial Panel. It does nothing...");
	label.setFont (new Font ("Serif", Font.BOLD, 30));
	pComponent.add (label);

	JLabel label2 =
	    new JLabel (registryModel.getDefaultRegistryEndpoint());
	pComponent.add (label2);

	return pComponent;
    }

    /**************************************************************************
     *
     **************************************************************************/
    public String getName() {
	return "Example Panel";
    }

    /**************************************************************************
     *
     **************************************************************************/
    public String getDescription() {
	return
	    "A panel that does nothing. It is used in the " +
	    "documentation for developers as a tutorial.";
    }

    /**************************************************************************
     *
     **************************************************************************/
    public boolean loadOnlyOnDemand() {
	return true;
    }

}
