source: extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/Main.java @ 9921

Last change on this file since 9921 was 9921, checked in by mlg, 13 years ago

Adds spring for the dependency injection
Deletion of jdom (not useful just for a class that manipulates a simple XML file)

File size: 2.8 KB
Line 
1package fr.mael.jiwigo;
2
3import java.io.File;
4import java.io.IOException;
5
6import javax.swing.UIManager;
7
8import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel;
9
10import fr.mael.jiwigo.transverse.util.Tools;
11import fr.mael.jiwigo.transverse.util.preferences.PreferencesManagement;
12import fr.mael.jiwigo.ui.ConnexionDialog;
13import fr.mael.jiwigo.ui.mainframe.MainFrame;
14
15/**
16   Copyright (c) 2010, Mael
17   All rights reserved.
18
19   Redistribution and use in source and binary forms, with or without
20   modification, are permitted provided that the following conditions are met:
21    * Redistributions of source code must retain the above copyright
22      notice, this list of conditions and the following disclaimer.
23    * Redistributions in binary form must reproduce the above copyright
24      notice, this list of conditions and the following disclaimer in the
25      documentation and/or other materials provided with the distribution.
26    * Neither the name of jiwigo nor the
27      names of its contributors may be used to endorse or promote products
28      derived from this software without specific prior written permission.
29
30   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
31   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
32   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
33   DISCLAIMED. IN NO EVENT SHALL Mael BE LIABLE FOR ANY
34   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
35   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
36   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
37   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
39   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40
41 * Main class
42 * @author mael
43 *
44 */
45public class Main {
46
47    /**
48     * Logger
49     */
50    public static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(Main.class);
51
52    /**
53     *  the main window
54     */
55    private static MainFrame mainFrame;
56
57    public static void main(String[] args) {
58        try {
59            UIManager.setLookAndFeel(new NimbusLookAndFeel());
60        } catch (Exception e) {
61        }
62        File dossierConfig = new File(System.getProperty("user.home") + "/.jiwigo");
63        if (!dossierConfig.exists()) {
64            dossierConfig.mkdir();
65        }
66        try {
67            PreferencesManagement.creerFichierParDefaut();
68            //dialog de connexion
69            ConnexionDialog dialog = new ConnexionDialog();
70            dialog.showDialog();
71        } catch (IOException e) {
72            LOG.error(Tools.getStackTrace(e));
73        }
74
75    }
76
77    public static void showFrame() {
78
79        if (mainFrame == null) {
80            mainFrame = MainFrame.getInstance();
81        }
82        if (!mainFrame.isVisible()) {
83            mainFrame.showUi();
84        }
85    }
86}
Note: See TracBrowser for help on using the repository browser.