1 /*
2 * @(#)$Id: JdomIconDescriptor.java 689 2009-07-22 00:10:27Z bsigner $
3 *
4 * Author : Ueli Kurmann, igesture@uelikurmann.ch
5 *
6 * Purpose : XML support for the TextDescriptor class.
7 *
8 * -----------------------------------------------------------------------
9 *
10 * Revision Information:
11 *
12 * Date Who Reason
13 *
14 * Dec 26, 2006 ukurmann Initial Release
15 * Mar 22, 2007 bsigner Cleanup
16 *
17 * -----------------------------------------------------------------------
18 *
19 * Copyright 1999-2009 ETH Zurich. All Rights Reserved.
20 *
21 * This software is the proprietary information of ETH Zurich.
22 * Use is subject to license terms.
23 *
24 */
25
26
27 package org.ximtec.igesture.core.jdom;
28
29 import org.jdom.Element;
30 import org.sigtec.jdom.element.JdomStringElement;
31 import org.ximtec.igesture.core.IconDescriptor;
32
33
34 /**
35 * XML support for the IconDescriptor class.
36 *
37 * @version 1.0, 22. October 2008
38 * @author Ueli Kurmann, igesture@uelikurmann.ch
39 * @author Beat Signer, signer@inf.ethz.ch
40 */
41 public class JdomIconDescriptor extends Element {
42
43 public static final String ROOT_TAG = "iconDescriptor";
44
45 public static final String UUID_ATTRIBUTE = "id";
46
47 public static final String PATH = "path";
48
49
50 public JdomIconDescriptor(IconDescriptor descriptor) {
51 super(ROOT_TAG);
52 setAttribute(UUID_ATTRIBUTE, descriptor.getId());
53 addContent(new JdomStringElement(PATH, descriptor.getPath()));
54 }
55
56
57 public static IconDescriptor unmarshal(Element descriptor) {
58 String uuid = descriptor.getAttributeValue(UUID_ATTRIBUTE);
59 IconDescriptor iconDescriptor = new IconDescriptor();
60 iconDescriptor.setId(uuid);
61 iconDescriptor.setPath(descriptor.getChild(PATH).getText());
62 return iconDescriptor;
63 } // unmarshal
64
65 }