/*
 * 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 cz.fidentis.analyst.newgui.swing;

import org.netbeans.api.settings.ConvertAsProperties;
import org.openide.windows.TopComponent;

/**
 * The non-singleton window/tab for detail inspection of a single face.
 * For the discussion on crating non-singleton top component, 
 * see {@link http://netbeans.apache.org/wiki/DevFaqNonSingletonTopComponents.asciidoc}.
 *
 * @author Richard Pajersky
 */
@ConvertAsProperties(
        dtd = "-//cz.fidentis.analyst.gui//CanvasTC//EN",
        autostore = false
)
/*
@TopComponent.Description(
        preferredID = "CanvasTC",
        //iconBase="SET/PATH/TO/ICON/HERE",
        persistenceType = TopComponent.PERSISTENCE_ALWAYS
)
@TopComponent.Registration(mode = "editor", openAtStartup = false)
@ActionID(category = "Window", id = "cz.fidentis.analyst.newgui.swing.CanvasTC")
@ActionReference(path = "Menu/Window")
@TopComponent.OpenActionRegistration(
        displayName = "#CTL_CanvasAction",
        preferredID = "CanvasTC"
)
@Messages({
    "CTL_CanvasAction=Canvas2",
    "CTL_CanvasTC=Canvas2",
    "HINT_CanvasTC=This is a Canvas window"
})
*/
public final class CanvasTC extends TopComponent {

    public CanvasTC() {
        initComponents();
        //setName(Bundle.CTL_CanvasTC());
        //setToolTipText(Bundle.HINT_CanvasTC());
        //putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.TRUE);
        //putClientProperty(TopComponent.PROP_DRAGGING_DISABLED, Boolean.TRUE);
        //putClientProperty(TopComponent.PROP_UNDOCKING_DISABLED, Boolean.TRUE);
    }
    
    @Override
    public int getPersistenceType() {
        return TopComponent.PERSISTENCE_NEVER; // TO DO: change to .PERSISTENCE_ONLY_OPENED when we can re-create the ProjectTC
    }

    /**
     * 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.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        canvas1 = new cz.fidentis.analyst.newgui.swing.Canvas();

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(canvas1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 685, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(canvas1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 476, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private cz.fidentis.analyst.newgui.swing.Canvas canvas1;
    // End of variables declaration//GEN-END:variables
    @Override
    public void componentOpened() {
        // TODO add custom code on component opening
    }

    @Override
    public void componentClosed() {
        // TODO add custom code on component closing
    }

    void writeProperties(java.util.Properties p) {
        // better to version settings since initial version as advocated at
        // http://wiki.apidesign.org/wiki/PropertyFiles
        p.setProperty("version", "1.0");
        // TODO store your settings
    }

    void readProperties(java.util.Properties p) {
        String version = p.getProperty("version");
        // TODO read your settings according to their version
    }
    
    public Canvas getCanvas() {
        return canvas1;
    }
}
