1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package cz.zcu.mre.sparkle.gui.query.triplePane;
21
22 import cz.zcu.mre.sparkle.gui.query.helpers.FieldType;
23 import cz.zcu.mre.sparkle.gui.query.other.TypedTextField;
24 import cz.zcu.mre.sparkle.tools.sparqlParser.SparqlParserTriple;
25 import static cz.zcu.mre.sparkle.gui.query.triplePane.TriplePane.XML_PREDICATE_ELEMENT_NAME;
26
27
28
29
30
31 class FieldProperties {
32
33 private String elementValue;
34 private FieldType elementFieldType;
35 private String objectLang = null;
36 private String objectDataType = null;
37 private final TypedTextField field;
38 private final SparqlParserTriple triple;
39
40 public FieldProperties(SparqlParserTriple triple, TypedTextField field) {
41 this.triple = triple;
42 this.field = field;
43 setTripleElementFieldType();
44 }
45
46 private void setTripleElementFieldType() {
47 String type = this.field.getPlaceholder();
48 if (type.equalsIgnoreCase(TriplePane.XML_SUBJECT_ELEMENT_NAME)) {
49 this.elementValue = this.triple.getSubject();
50 this.elementFieldType = this.triple.getSubjectFieldType();
51 } else if (type.equalsIgnoreCase(XML_PREDICATE_ELEMENT_NAME)) {
52 this.elementValue = this.triple.getPredicate();
53 this.elementFieldType = this.triple.getPredicateFieldType();
54 } else {
55 this.elementValue = this.triple.getObject();
56 this.elementFieldType = this.triple.getObjectFieldType();
57 this.objectLang = this.triple.getLiteralLang();
58 this.objectDataType = this.triple.getLiteralDataType();
59 }
60 }
61
62 public String getElementValue() {
63 return this.elementValue;
64 }
65
66 public FieldType getElemeFieldType() {
67 return this.elementFieldType;
68 }
69
70 public String getObjectLang() {
71 return this.objectLang;
72 }
73
74 public String getObjectDataType() {
75 return this.objectDataType;
76 }
77
78 }