Statistics
| Revision:

root / trunk / extensions / extHyperlink / src / org / gvsig / hyperlink / config / LinkConfig.java @ 28132

History | View | Annotate | Download (1.84 KB)

1
package org.gvsig.hyperlink.config;
2

    
3
import com.iver.utiles.IPersistence;
4
import com.iver.utiles.XMLEntity;
5

    
6
public class LinkConfig implements IPersistence {
7
        private String fieldName;
8
        private String extension = "";
9
        private String actionCode;
10

    
11
        protected LinkConfig() {
12
        }
13

    
14
        public LinkConfig(String actionCode, String fieldName) {
15
                this.actionCode = actionCode;
16
                this.fieldName = fieldName;
17
        }
18

    
19
        public LinkConfig(String actionCode, String fieldName, String extension) {
20
                this.actionCode = actionCode;
21
                this.fieldName = fieldName;
22
                this.extension = extension;
23
        }
24

    
25
        public String getFieldName() {
26
                return fieldName;
27
        }
28

    
29
        public String getActionCode() {
30
                return actionCode;
31
        }
32

    
33
        public void setFieldName(String fieldName) {
34
                this.fieldName = fieldName;
35
        }
36

    
37
        public void setActionCode(String actionCode) {
38
                this.actionCode = actionCode;
39
        }
40

    
41
        public void setExtension(String extension) {
42
                this.extension = extension;
43
        }
44

    
45
        public String getExtension() {
46
                return extension;
47
        }
48

    
49
        public String getClassName() {
50
                return this.getClass().getName();
51
        }
52

    
53
        public XMLEntity getXMLEntity() {
54
                XMLEntity xml = new XMLEntity();
55
                xml.putProperty("className", this.getClassName());
56
                xml.putProperty("actionCode", getActionCode());
57
                xml.putProperty("fieldName", getFieldName());
58
                xml.putProperty("extension", getExtension());
59
                return xml;
60
        }
61

    
62
        public void setXMLEntity(XMLEntity xml) {
63
                if (xml.contains("actionCode")) {
64
                        setActionCode(xml.getStringProperty("actionCode"));
65
                }
66
                else {
67
                        setActionCode("");
68
                }
69
                if (xml.contains("fieldName")) {
70
                        setFieldName(xml.getStringProperty("fieldName"));
71
                }
72
                else {
73
                        setFieldName("");
74
                }
75
                if (xml.contains("extension")) {
76
                        setExtension(xml.getStringProperty("extension"));
77
                }
78
        }
79

    
80
        public static LinkConfig createFromXMLEntity(XMLEntity xml) {
81
                LinkConfig link = new LinkConfig();
82
                link.setXMLEntity(xml);
83
                return link;
84
        }
85
}