Package de.netsysit.policymanager

Source Code of de.netsysit.policymanager.PolicyManager

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

import de.netsysit.controller.ActionFactory;
import de.netsysit.model.DataBaseModel;
import de.netsysit.view.MainFrame;
import java.awt.EventQueue;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

/**
*
* @author ducksoul
*/
public class PolicyManager {

    private static DataBaseModel model;

    /**
     * This method returns the DataBaseModel object which contains all
     * the data.
     * @return A DataBaseModel
     */
    public static DataBaseModel getPolicyModel() {
        if (model == null) {
            model = new DataBaseModel();
            PolicyUtilities.setSystemState(PolicyUtilities.createSystemStateString(model));
        }
        return model;
    }
   
    /**
     * This method initiates the program and shows the mainframe centered
     * on the screen.
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(PolicyManager.class.getName()).log(Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            Logger.getLogger(PolicyManager.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            Logger.getLogger(PolicyManager.class.getName()).log(Level.SEVERE, null, ex);
        } catch (UnsupportedLookAndFeelException ex) {
            Logger.getLogger(PolicyManager.class.getName()).log(Level.SEVERE, null, ex);
        }
       
        ActionFactory.init();
  EventQueue.invokeLater(new Runnable() {
            @Override public void run() {
                try {
                    MainFrame mainFrame = MainFrame.getInstance();
                    mainFrame.setLocationRelativeTo(null);
                    mainFrame.setVisible(true);
                } catch (Exception e) {System.out.println(e.getMessage());}
    }
  });
       
       
    }
}
TOP

Related Classes of de.netsysit.policymanager.PolicyManager

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.