Ignore:
Timestamp:
May 1, 2011, 12:21:14 PM (14 years ago)
Author:
mlg
Message:

new feature : the user is now able to delete a category from the categories tree (right click on the category).

Location:
extensions/jiwigo/trunk/src/main
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/ui/mainframe/CategoriesTree.java

    r10697 r10715  
    7272     * the menu to add a category
    7373     */
    74     private JMenuItem menuAjouter;
     74    private JMenuItem menuAdd;
    7575    /**
    7676     * the menu to refresh the categories
    7777     */
    78     private JMenuItem menuActualiser;
     78    private JMenuItem menuRefresh;
    7979    /**
    8080     * the root of the tree which is not displayed
     
    8585     */
    8686    private Category selectedCategory;
     87    /**
     88     * the menu to add a category
     89     */
     90    private JMenuItem menuDelete;
    8791
    8892    /**
     
    197201        if (e.getButton() == 3) {
    198202            JPopupMenu popup = new JPopupMenu();
    199             menuAjouter = new JMenuItem(Messages.getMessage("categories_add"));
    200             menuAjouter.addActionListener(this);
    201             popup.add(menuAjouter);
    202             menuActualiser = new JMenuItem(Messages.getMessage("categories_update"));
    203             menuActualiser.addActionListener(this);
    204             popup.add(menuActualiser);
     203            menuAdd = new JMenuItem(Messages.getMessage("categories_add"));
     204            menuAdd.addActionListener(this);
     205            popup.add(menuAdd);
     206            menuRefresh = new JMenuItem(Messages.getMessage("categories_update"));
     207            menuRefresh.addActionListener(this);
     208            popup.add(menuRefresh);
     209            menuDelete = new JMenuItem(Messages.getMessage("categories_delete"));
     210            menuDelete.addActionListener(this);
     211            popup.add(menuDelete);
    205212            popup.show(tree, e.getX(), e.getY());
    206213            if (selRow != -1) {
     
    222229    @Override
    223230    public void actionPerformed(ActionEvent arg0) {
    224         if (arg0.getSource().equals(menuAjouter)) {
     231        if (arg0.getSource().equals(menuAdd)) {
    225232            String nomcategorie = JOptionPane.showInputDialog(null, Messages.getMessage("categories_enterName"),
    226233                    Messages.getMessage("categories_add"), JOptionPane.INFORMATION_MESSAGE);
     
    263270                }
    264271            }
    265         } else if (arg0.getSource().equals(menuActualiser)) {
     272        } else if (arg0.getSource().equals(menuRefresh)) {
    266273            setUpUi();
     274        } else if (arg0.getSource().equals(menuDelete)) {
     275            try {
     276                if (SpringUtils.getCategoryService().delete(selectedCategory)) {
     277                    setUpUi();
     278                } else {
     279                    JOptionPane.showMessageDialog(null, Messages.getMessage("deletingCategoryError"),
     280                            Messages.getMessage("error"), JOptionPane.ERROR_MESSAGE);
     281                }
     282            } catch (Exception e) {
     283                LOG.error(Tools.getStackTrace(e));
     284                JOptionPane.showMessageDialog(null, Messages.getMessage("deletingCategoryError"),
     285                        Messages.getMessage("error"), JOptionPane.ERROR_MESSAGE);
     286            }
    267287        }
    268288    }
  • extensions/jiwigo/trunk/src/main/resources/fr/mael/jiwigo/trad/messages.properties

    r9894 r10715  
    7171unexpectedSendingError=<html><center>Unexpected error while sending images. The images will probably not be created.<br/>Affected images are :</center><ul>%s</ul></html>
    7272fileAlreadyExistsError=<html><center>Some of the selected files exist on the server. They will not be created.<br/>Affected images are :</center><ul>%s</ul></html>
     73deletingCategoryError=Unexpected error while deleting the category
    7374
    7475#####################################################
     
    8384categories_update=Refresh
    8485categories_enterName=Fill the category name
     86categories_delete=Delete
    8587
    8688
  • extensions/jiwigo/trunk/src/main/resources/fr/mael/jiwigo/trad/messages_en.properties

    r9897 r10715  
    7171unexpectedSendingError=<html><center>Unexpected error while sending images. The images will probably not be created.<br/>Affected images are :</center><ul>%s</ul></html>
    7272fileAlreadyExistsError=<html><center>Some of the selected files exist on the server. They will not be created.<br/>Affected images are :</center><ul>%s</ul></html>
     73deletingCategoryError=Unexpected error while deleting the category
    7374
    7475#####################################################
     
    8384categories_update=Refresh
    8485categories_enterName=Fill the category name
     86categories_delete=Delete
    8587
    8688
  • extensions/jiwigo/trunk/src/main/resources/fr/mael/jiwigo/trad/messages_fr.properties

    r9894 r10715  
    7171unexpectedSendingError=<html><center>Erreur inattendue lors de l'envoi des images. Les images ne seront probablement pas créées.<br/>Les images concernées sont : </center><ul>%s</ul></html>
    7272fileAlreadyExistsError=<html><center>Certains des fichiers envoyés existent sur le serveur. Les images ne seront pas créées.<br/>Les images concernées sont : </center><ul>%s</ul></html>
     73deletingCategoryError=Erreur inattendue lors de la suppression de la catégorie
    7374
    7475#####################################################
     
    8384categories_update=Actualiser
    8485categories_enterName=Entrez le nom de la catégorie
     86categories_delete=Supprimer
    8587
    8688
Note: See TracChangeset for help on using the changeset viewer.