package com.imsl.demo.cluster;

public class ClusterReport extends javax.swing.JDialog implements java.awt.event.WindowListener {
    private javax.swing.JEditorPane jEditorPane;
    private javax.swing.JToggleButton viewToggleButton;

    public ClusterReport(java.awt.Frame parentFrame, String title, javax.swing.JToggleButton button) {
        super(parentFrame, false);
        this.viewToggleButton = button;
        addWindowListener(this);
        setTitle(title);
        jEditorPane = new javax.swing.JEditorPane();
        jEditorPane.setContentType("text/html");
        jEditorPane.setEditable(false);
        javax.swing.JScrollPane scroll = new javax.swing.JScrollPane(jEditorPane);
        getContentPane().add(scroll);
        scroll.setPreferredSize(new java.awt.Dimension(250, parentFrame.getSize().height-32));
        pack();
    }

    void setText(String text) {
        jEditorPane.setText(text);
        jEditorPane.setCaretPosition(0);
    }

    /** Invoked when the Window is set to be the active Window. Only a Frame or
     * a Dialog can be the active Window. The native windowing system may
     * denote the active Window or its children with special decorations, such
     * as a highlighted title bar. The active Window is always either the
     * focused Window, or the first Frame or Dialog that is an owner of the
     * focused Window.
     *
     */
    public void windowActivated(java.awt.event.WindowEvent e) {
    }

    /** Invoked when a window has been closed as the result
     * of calling dispose on the window.
     *
     */
    public void windowClosed(java.awt.event.WindowEvent e) {
    }

    /** Invoked when the user attempts to close the window
     * from the window's system menu.  If the program does not
     * explicitly hide or dispose the window while processing
     * this event, the window close operation will be cancelled.
     *
     */
    public void windowClosing(java.awt.event.WindowEvent e) {
        viewToggleButton.setSelected(false);
    }

    /** Invoked when a Window is no longer the active Window. Only a Frame or a
     * Dialog can be the active Window. The native windowing system may denote
     * the active Window or its children with special decorations, such as a
     * highlighted title bar. The active Window is always either the focused
     * Window, or the first Frame or Dialog that is an owner of the focused
     * Window.
     *
     */
    public void windowDeactivated(java.awt.event.WindowEvent e) {
    }

    /** Invoked when a window is changed from a minimized
     * to a normal state.
     *
     */
    public void windowDeiconified(java.awt.event.WindowEvent e) {
    }

    /** Invoked when a window is changed from a normal to a
     * minimized state. For many platforms, a minimized window
     * is displayed as the icon specified in the window's
     * iconImage property.
     * @see java.awt.Frame#setIconImage
     *
     */
    public void windowIconified(java.awt.event.WindowEvent e) {
    }

    /** Invoked the first time a window is made visible.
     *
     */
    public void windowOpened(java.awt.event.WindowEvent e) {
    }
}