Changeset 6962
- Timestamp:
- Sep 19, 2010, 3:19:40 PM (14 years ago)
- Location:
- extensions/jiwigo/trunk/src
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/dao/CategoryDao.java
r6831 r6962 97 97 public boolean creer(Category category) { 98 98 try { 99 return Outil.checkOk(Main.sessionManager.executerReturnDocument(MethodsEnum.AJOUTER_CATEGORIE.getLabel(), 100 "name", category.getNom(), "parent", String.valueOf(category.getParentDirect()))); 99 if (category.getParentDirect() != null) { 100 return Outil.checkOk(Main.sessionManager.executerReturnDocument(MethodsEnum.AJOUTER_CATEGORIE 101 .getLabel(), "name", category.getNom(), "parent", String.valueOf(category.getParentDirect()))); 102 } else { 103 return Outil.checkOk(Main.sessionManager.executerReturnDocument(MethodsEnum.AJOUTER_CATEGORIE 104 .getLabel(), "name", category.getNom())); 105 } 101 106 } catch (IOException e) { 102 107 LOG.error(Outil.getStackTrace(e)); -
extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/om/Category.java
r6821 r6962 63 63 idCategoriesMeres = new ArrayList<Integer>(); 64 64 for (String cat : catMeres.split(",")) { 65 idCategoriesMeres.add(Integer.valueOf(cat)); 65 if (!cat.equals("")) { 66 idCategoriesMeres.add(Integer.valueOf(cat)); 67 } 66 68 } 67 69 categoriesFilles = new ArrayList<Category>(); -
extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/service/CategoryService.java
r6831 r6962 113 113 return CategoryDao.getInstance().creer(category); 114 114 } 115 116 /** 117 * Création d'une catégorie 118 * @param nom nom de la catégorie 119 * @param parent catégorie parent 120 * @return true si la catégorie a bien été créée 121 */ 122 public boolean creer(String nom) { 123 Category category = new Category(); 124 category.setNom(nom); 125 return CategoryDao.getInstance().creer(category); 126 } 115 127 } -
extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/ui/mainframe/CategoriesTree.java
r6958 r6962 189 189 tree.setSelectionRow(selRow); 190 190 //end 191 if (selRow != -1) { 192 if (e.getButton() == 3) { 193 JPopupMenu popup = new JPopupMenu(); 194 menuAjouter = new JMenuItem(Messages.getMessage("categories_add")); 195 menuAjouter.addActionListener(this); 196 popup.add(menuAjouter); 197 menuActualiser = new JMenuItem(Messages.getMessage("categories_update")); 198 menuActualiser.addActionListener(this); 199 popup.add(menuActualiser); 200 popup.show(tree, e.getX(), e.getY()); 191 192 if (e.getButton() == 3) { 193 JPopupMenu popup = new JPopupMenu(); 194 menuAjouter = new JMenuItem(Messages.getMessage("categories_add")); 195 menuAjouter.addActionListener(this); 196 popup.add(menuAjouter); 197 menuActualiser = new JMenuItem(Messages.getMessage("categories_update")); 198 menuActualiser.addActionListener(this); 199 popup.add(menuActualiser); 200 popup.show(tree, e.getX(), e.getY()); 201 if (selRow != -1) { 201 202 DefaultMutableTreeNode node = (DefaultMutableTreeNode) (selPath.getLastPathComponent()); 202 203 this.selectedCategory = (Category) node.getUserObject(); 204 } else { 205 this.selectedCategory = null; 203 206 } 204 207 } … … 217 220 String nomcategorie = JOptionPane.showInputDialog(null, Messages.getMessage("categories_enterName"), 218 221 Messages.getMessage("categories_add"), JOptionPane.INFORMATION_MESSAGE); 222 //if the name of the category is not empty 219 223 if (!(nomcategorie == null) && !nomcategorie.equals("")) { 220 if (CategoryService.getInstance().creer(nomcategorie, selectedCategory.getIdentifiant())) { 221 setUpUi(); 224 //if there is a parent category 225 if (selectedCategory != null) { 226 //try to create a category 227 if (CategoryService.getInstance().creer(nomcategorie, selectedCategory.getIdentifiant())) { 228 setUpUi(); 229 } else { 230 JOptionPane.showMessageDialog(null, Messages.getMessage("categoryCreationError"), Messages 231 .getMessage("error"), JOptionPane.ERROR_MESSAGE); 232 233 } 222 234 } else { 223 JOptionPane.showMessageDialog(null, Messages.getMessage("categoryCreationError"), Messages 224 .getMessage("error"), JOptionPane.ERROR_MESSAGE); 225 235 if (CategoryService.getInstance().creer(nomcategorie)) { 236 setUpUi(); 237 } else { 238 JOptionPane.showMessageDialog(null, Messages.getMessage("categoryCreationError"), Messages 239 .getMessage("error"), JOptionPane.ERROR_MESSAGE); 240 241 } 226 242 } 227 243 } -
extensions/jiwigo/trunk/src/main/resources/log4j.xml
r6959 r6962 23 23 <!-- Déclaration loggers --> 24 24 <logger name="fr.mael.jiwigo" additivity="false"> 25 <level value=" DEBUG" />25 <level value="INFO" /> 26 26 <appender-ref ref="console" /> 27 27 <appender-ref ref="fichier" />
Note: See TracChangeset
for help on using the changeset viewer.