source: extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/ui/mainframe/MainFrame.java @ 6821

Last change on this file since 6821 was 6821, checked in by mlg, 14 years ago

Premier commit. Actuellement, l'application gère :
-Listing des catégories
-Affichage des miniatures
-Ajout de commentaires
-gestion d'un cache pour ne pas télécharger les images plusieurs fois
-gestion d'un zoom dans le navigateur d'images
-navigateur d'images complètement refait, je viens de tester sur un grand écran, à priori, c'est beaucoup mieux
-meilleure gestion des exceptions, avec affichage de messages d'erreurs
-ajout d'un "logger" qui enregistre toutes les exceptions dans un fichier de log
-possibilité de ne pas mettre le "http://" dans l'écran de connexion
-gestion de transformations d'images dans le navigateur d'images : "flip" horizontal et vertical, rotations
-menu dans le navigateur d'images, qui permet d'effectuer toutes les actions, avec en plus, la possibilité d'imprimer une image

en cours d'implémentation : gestion des préférences de l'utilisateur. Actuellement, le fichier xml permettant d'écrire les préférences est géré,
il reste à faire un écran de gestion des préférences, avec un maximum d'options, afin que l'appli soit configurable.

File size: 4.3 KB
Line 
1package fr.mael.jiwigo.ui.mainframe;
2
3import java.awt.BorderLayout;
4import java.awt.FlowLayout;
5
6import javax.swing.JFrame;
7import javax.swing.JLabel;
8import javax.swing.JPanel;
9import javax.swing.JScrollPane;
10import javax.swing.JSplitPane;
11
12import fr.mael.jiwigo.transverse.util.Messages;
13import fr.mael.jiwigo.transverse.util.Outil;
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 * @author mael
42 * Frame principale
43 */
44public class MainFrame extends JFrame {
45    /**
46     * Logger
47     */
48    public static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory
49            .getLog(MainFrame.class);
50    /**
51     * l'arbre des catégories
52     */
53    private CategoriesTree categoriesTree;
54    /**
55     * Splitpane avec à gauche l'arbre et à droite les miniatures pour la catégorie
56     * courante
57     */
58    private JSplitPane splitPane;
59    /**
60     * Panel contenant les miniatures de la catégorie courante
61     */
62    public static MiniaturesCategoryPanel imagesPanel;
63    /**
64     *  Scrollpane contenant le panel ci dessus
65     */
66    private JScrollPane scrollPaneImagesPanel;
67    /**
68     * label qui affiche des messages
69     */
70    private JLabel labelMessage;
71
72    /**
73     * singleton
74     */
75    private static MainFrame instance;
76
77    /**
78     * @return le singleton
79     */
80    public static MainFrame getInstance() {
81        if (instance == null) {
82            instance = new MainFrame();
83        }
84        return instance;
85    }
86
87    /**
88     * COnstructeur privé, permettant de n'avoir accès qu'au singleton
89     */
90    private MainFrame() {
91        this.setTitle("Piwigo v" + Messages.getMessage("version"));
92        this.setIconImage(java.awt.Toolkit.getDefaultToolkit().getImage(Outil.getURL("fr/mael/jiwigo/img/icon.png")));
93        this.setLayout(new BorderLayout());
94        labelMessage = new JLabel(Messages.getMessage("welcomeMessage"));
95        splitPane = new JSplitPane();
96        categoriesTree = new CategoriesTree();
97        splitPane.setLeftComponent(categoriesTree);
98        imagesPanel = new MiniaturesCategoryPanel(null);
99        scrollPaneImagesPanel = new JScrollPane(imagesPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
100                JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
101        splitPane.setRightComponent(scrollPaneImagesPanel);
102
103        this.add(splitPane, BorderLayout.WEST);
104        JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
105        panel.add(labelMessage);
106        this.add(panel, BorderLayout.SOUTH);
107        this.pack();
108        this.setLocationRelativeTo(null);
109        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
110        this.setResizable(false);
111    }
112
113    /**
114     * affichage de la frame
115     */
116    public void showUi() {
117        this.setVisible(true);
118    }
119
120    /**
121     * Affichage d'un message d'erreur
122     * @param message
123     */
124    public void setErrorMessage(String message) {
125        this.labelMessage.setText(message);
126    }
127
128    /**
129     * Affichage d'un message de réussite
130     * @param message
131     */
132    public void setReussiteMessage(String message) {
133        this.labelMessage.setText(message);
134    }
135
136}
Note: See TracBrowser for help on using the repository browser.