Example usage for org.jdom2 Element getName

List of usage examples for org.jdom2 Element getName

Introduction

In this page you can find the example usage for org.jdom2 Element getName.

Prototype

public String getName() 

Source Link

Document

Returns the (local) name of the element (without any namespace prefix).

Usage

From source file:model.data.favorites.KnownUsers.java

License:Open Source License

@Override
protected boolean handleElement(Element e) {
    if (e.getName().equals("users")) {
        return parseUsers(e);
    } else//  w  w  w  .j  a  v a2s  . c om
        return false;
}

From source file:model.data.item.Item.java

License:Open Source License

@Override
protected boolean handleElement(org.jdom2.Element e) {
    String val = e.getText();
    switch (e.getName()) {
    case "friendNick":
        setFriendlyNick(val);
        return true;
    case "title":
        setTitle(val);
        return true;
    case "category":
        setCategory(new Category(val));
        return true;
    case "description":
        setDescription(val);
        return true;
    case "image":
        setImage(val);
        return true;
    case "country":
        setCountry(val);
        return true;
    case "contact":
        setContact(val);
        return true;
    case "date":
        setDate(Long.parseLong(val));
        return true;
    case "lifeTime":
        setLifeTime(Long.parseLong(val));
        return true;
    case "type":
        if (val.toLowerCase().equals(TYPE.OFFER.toString().toLowerCase()))
            setType(TYPE.OFFER);//  w w w . jav  a 2  s . c om
        else if (val.toLowerCase().equals(TYPE.DEMAND.toString().toLowerCase()))
            setType(TYPE.DEMAND);
        else {
            return false;
        }
        return true;
    default:
        return false;
    }
}

From source file:model.data.manager.ContratManager.java

License:Open Source License

/**
 * Load all the deals in this element//from  w  ww .j ava 2  s .  co  m
 * @param e an element that contains messages in XML format.
 */
protected void loadDeals(Element e) {
    Element root = StringToElement.getElementFromString(e.getValue(), e.getName());
    for (Element d : root.getChildren()) {
        String owner = d.getChildText("owner");
        Element deal = d.getChild("Deal");
        addDeal(owner, new Contrat(deal));
    }
}

From source file:model.data.manager.FavoriteManager.java

License:Open Source License

/**
 * Load all the favorites in this element
 * @param e an element that contains messages in XML format.
 *//*  w w w . j a v  a 2s.  c  om*/
protected void loadFavorites(Element e) {
    Element root = StringToElement.getElementFromString(e.getValue(), e.getName());
    for (Element f : root.getChildren()) {
        addFavorites(new Favorites(f));
    }
}

From source file:model.data.manager.ItemManager.java

License:Open Source License

/**
 * Load all the items in this element//from  w  ww .  ja v  a  2s  . c om
 * @param e an element that contains items in XML format.
 * TODO a voir
 */
protected void loadItems(Element e) {
    Element root = StringToElement.getElementFromString(e.getValue(), e.getName());
    for (Element i : root.getChildren()) {
        addItem(new Item(i));
    }
}

From source file:model.data.manager.Manager.java

License:Open Source License

@Override
protected boolean handleElement(Element e) {
    switch (e.getName()) {
    case "users":
        userManager.loadUsers(e);// w  w  w .  j  av  a 2  s.c  o  m
        break;
    case "items":
        itemManager.loadItems(e);
        break;
    case "messages":
        /*TODO loadMessages(e);*/ break;
    case "ReceivedMessages":
        messageManager.loadReceivedMessages(e);
        break;
    case "favorites":
        favoriteManager.loadFavorites(e);
        break;
    case "deals":
        contratManager.loadDeals(e);
        break;
    default:
        return false;
    }
    return true;
}

From source file:model.data.manager.MessageManager.java

License:Open Source License

/**
 * Load all the messages in this element
 * @param e an element that contains messages in XML format.
 */// w  ww. j  a  v  a 2s. c o  m
protected void loadReceivedMessages(Element e) {
    Element root = StringToElement.getElementFromString(e.getValue(), e.getName());
    for (Element m : root.getChildren()) {
        addConversations(new Conversations(m));
    }
}

From source file:model.data.manager.UserManager.java

License:Open Source License

/**
 * Load all the users in this element/*from  www  .j a va 2s .com*/
 * @param e an element that contains users in XML format.
 * TODO a voir
 */
protected void loadUsers(Element e) {
    Element root = StringToElement.getElementFromString(e.getValue(), e.getName());
    for (Element u : root.getChildren()) {
        addUser(new User(u));
    }
}

From source file:model.data.RendezVousIp.java

License:Open Source License

@Override
protected boolean handleElement(Element e) {
    switch (e.getName()) {
    case "ips":
        ips = StringToElement.getElementFromString(e.getValue());
        return true;
    }//from   w w  w . j av  a2 s .c  om
    return false;
}

From source file:model.data.user.Conversations.java

License:Open Source License

@Override
protected boolean handleElement(Element e) {
    if (e.getName().equals("cypher")) {
        cypher = e.getValue();//from   w w w.  j  av a  2s.c  om
        return true;
    }
    if (e.getName().equals("owner")) {
        owner = e.getValue();
        return true;
    }
    return false;
}