source: extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/om/Category.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: 5.8 KB
Line 
1package fr.mael.jiwigo.om;
2
3import java.util.ArrayList;
4
5import org.jdom.Element;
6
7import fr.mael.jiwigo.transverse.enumeration.CategoryEnum;
8
9/**
10   Copyright (c) 2010, Mael
11   All rights reserved.
12
13   Redistribution and use in source and binary forms, with or without
14   modification, are permitted provided that the following conditions are met:
15    * Redistributions of source code must retain the above copyright
16      notice, this list of conditions and the following disclaimer.
17    * Redistributions in binary form must reproduce the above copyright
18      notice, this list of conditions and the following disclaimer in the
19      documentation and/or other materials provided with the distribution.
20    * Neither the name of jiwigo nor the
21      names of its contributors may be used to endorse or promote products
22      derived from this software without specific prior written permission.
23
24   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
25   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27   DISCLAIMED. IN NO EVENT SHALL Mael BE LIABLE FOR ANY
28   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34   
35 * @author mael
36 *
37 */
38public class Category {
39
40    private ArrayList<Integer> idCategoriesMeres;
41    private Integer identifiant;
42    private String urlCategory;
43    private Integer nbImages;
44    private Integer nbTotalImages;
45    private ArrayList<Category> categoriesFilles;
46    private ArrayList<Category> categoriesMeres;
47    private String nom;
48    private Element element;
49    private Integer parentDirect;
50
51    /**
52     * Constructeur. Une categorie est cree a partir de son element xml
53     * @param element
54     */
55    public Category(Element element) {
56        this.element = element;
57        this.identifiant = Integer.valueOf(element.getAttributeValue(CategoryEnum.ID.getLabel()));
58        this.urlCategory = element.getAttributeValue(CategoryEnum.URL.getLabel());
59        this.nbImages = Integer.valueOf(element.getAttributeValue(CategoryEnum.NB_IMAGES.getLabel()));
60        this.nbTotalImages = Integer.valueOf(element.getAttributeValue(CategoryEnum.NB_TOTAL_IMAGES.getLabel()));
61        this.nom = element.getChildText(CategoryEnum.NAME.getLabel());
62        String catMeres = element.getChildText(CategoryEnum.CAT_MERES.getLabel());
63        idCategoriesMeres = new ArrayList<Integer>();
64        for (String cat : catMeres.split(",")) {
65            idCategoriesMeres.add(Integer.valueOf(cat));
66        }
67        categoriesFilles = new ArrayList<Category>();
68        categoriesMeres = new ArrayList<Category>();
69    }
70
71    public Category() {
72        // TODO Auto-generated constructor stub
73    }
74
75    @Override
76    public String toString() {
77        return nom;
78    }
79
80    /**
81     * @return the idCategoriesMeres
82     */
83    public ArrayList<Integer> getIdCategoriesMeres() {
84        return idCategoriesMeres;
85    }
86
87    /**
88     * @param idCategoriesMeres the idCategoriesMeres to set
89     */
90    public void setIdCategoriesMeres(ArrayList<Integer> idCategoriesMeres) {
91        this.idCategoriesMeres = idCategoriesMeres;
92    }
93
94    /**
95     * @return the identifiant
96     */
97    public Integer getIdentifiant() {
98        return identifiant;
99    }
100
101    /**
102     * @param identifiant the identifiant to set
103     */
104    public void setIdentifiant(Integer identifiant) {
105        this.identifiant = identifiant;
106    }
107
108    /**
109     * @return the urlCategory
110     */
111    public String getUrlCategory() {
112        return urlCategory;
113    }
114
115    /**
116     * @param urlCategory the urlCategory to set
117     */
118    public void setUrlCategory(String urlCategory) {
119        this.urlCategory = urlCategory;
120    }
121
122    /**
123     * @return the nbImages
124     */
125    public Integer getNbImages() {
126        return nbImages;
127    }
128
129    /**
130     * @param nbImages the nbImages to set
131     */
132    public void setNbImages(Integer nbImages) {
133        this.nbImages = nbImages;
134    }
135
136    /**
137     * @return the nbTotalImages
138     */
139    public Integer getNbTotalImages() {
140        return nbTotalImages;
141    }
142
143    /**
144     * @param nbTotalImages the nbTotalImages to set
145     */
146    public void setNbTotalImages(Integer nbTotalImages) {
147        this.nbTotalImages = nbTotalImages;
148    }
149
150    /**
151     * @return the categoriesFilles
152     */
153    public ArrayList<Category> getCategoriesFilles() {
154        return categoriesFilles;
155    }
156
157    /**
158     * @param categoriesFilles the categoriesFilles to set
159     */
160    public void setCategoriesFilles(ArrayList<Category> categoriesFilles) {
161        this.categoriesFilles = categoriesFilles;
162    }
163
164    /**
165     * @return the categoriesMeres
166     */
167    public ArrayList<Category> getCategoriesMeres() {
168        return categoriesMeres;
169    }
170
171    /**
172     * @param categoriesMeres the categoriesMeres to set
173     */
174    public void setCategoriesMeres(ArrayList<Category> categoriesMeres) {
175        this.categoriesMeres = categoriesMeres;
176    }
177
178    /**
179     * @return the nom
180     */
181    public String getNom() {
182        return nom;
183    }
184
185    /**
186     * @param nom the nom to set
187     */
188    public void setNom(String nom) {
189        this.nom = nom;
190    }
191
192    /**
193     * @return the element
194     */
195    public Element getElement() {
196        return element;
197    }
198
199    /**
200     * @param element the element to set
201     */
202    public void setElement(Element element) {
203        this.element = element;
204    }
205
206    /**
207     * @return the parentDirect
208     */
209    public Integer getParentDirect() {
210        return parentDirect;
211    }
212
213    /**
214     * @param parentDirect the parentDirect to set
215     */
216    public void setParentDirect(Integer parentDirect) {
217        this.parentDirect = parentDirect;
218    }
219
220}
Note: See TracBrowser for help on using the repository browser.