view src/MPipeline/src/mpipeline/MDocument.java @ 27:29276498ebdb database-connection-manager

Remove LTPDARepositoryManager implementation * * * Remove GUI helper
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mpipeline;

import java.beans.PropertyVetoException;
import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JInternalFrame;

/**
 * Base object for block diagrams.
 * 
 * @author hewitson
 */
public class MDocument extends JInternalFrame implements Serializable{

    /**
     * Construct a document.
     */
    public MDocument() {        
        int nDocs = this.getDesktopPane().getComponentCount();
        this.setName("New Document " + nDocs+1);
        makeDocument();        
    }
    /**
     * Construct a document with the given name.
     * 
     * @param name
     */
    public MDocument(String name){        
        this.setName(name);
        makeDocument();
    }
    /**
     * Construct a document with the given number.
     * @param num
     */
    public MDocument(int num) {
        this.setName("New Document " + num);
        makeDocument();
    }

    /**
     * Build the document object.
     */
    private void makeDocument(){
        this.setMaximizable(true);
        this.setResizable(true);
        this.setIconifiable(true);
        this.setClosable(true);
        this.setSize(500, 300);
        this.setVisible(true);
    }
    
    /**
     * Maximise the document in the container.
     * @param state
     */
    public void maximise(boolean state) {
        try {
            this.setMaximum(state);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(this.getParent().getName()).log(Level.SEVERE, null, ex);
        }
    }
}