Ignore:
Timestamp:
Sep 19, 2010, 9:27:31 PM (14 years ago)
Author:
mlg
Message:

Feature :
Adds the ui to add tags. It's done in the thumbnail viewer (right click on the thumbnail)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/jiwigo/trunk/src/main/java/fr/mael/jiwigo/dao/TagDao.java

    r6964 r6968  
    99
    1010import fr.mael.jiwigo.Main;
     11import fr.mael.jiwigo.om.Image;
    1112import fr.mael.jiwigo.om.Tag;
    1213import fr.mael.jiwigo.transverse.enumeration.MethodsEnum;
     
    7879        Document doc = Main.sessionManager.executerReturnDocument(MethodsEnum.LISTER_TAGS.getLabel());
    7980        //      System.out.println(Outil.documentToString(doc));
    80         Element element = doc.getRootElement().getChild("tags");
     81        return getTagsFromDocument(doc.getRootElement().getChild("tags"));
     82
     83    }
     84
     85    /**
     86     * COnstructs a list of tags from a document
     87     * @param doc the document
     88     * @return the list of tags
     89     */
     90    private List<Tag> getTagsFromDocument(Element element) {
     91
    8192        List<Element> listElement = (List<Element>) element.getChildren("tag");
    8293        ArrayList<Tag> tags = new ArrayList<Tag>();
     
    8697        }
    8798        return tags;
     99
    88100    }
    89101
     
    103115    }
    104116
     117    /**
     118     * Function that returns the tags for an image
     119     * @param image the image
     120     * @return the tags list
     121     * @throws IOException
     122     */
     123    public List<Tag> tagsForImage(Image image) throws IOException {
     124        Document doc = Main.sessionManager.executerReturnDocument(MethodsEnum.GET_INFO.getLabel(), "image_id", String
     125                .valueOf(image.getIdentifiant()));
     126        return getTagsFromDocument(doc.getRootElement().getChild("image").getChild("tags"));
     127    }
     128
    105129}
Note: See TracChangeset for help on using the changeset viewer.