1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package olr.viewer;
18
19 import olr.rdf.Definitions;
20 import olr.rdf.Resource;
21 import olr.rdf.Tools;
22
23 /***
24 * @version $Id: ModelViewerRow.java,v 1.5 2004/08/03 08:33:53 roku Exp $
25 */
26 public class ModelViewerRow {
27
28 public ModelViewerRow(ModelViewer modelViewer, String resource, int level, boolean isPredicate) {
29 this(modelViewer, resource, level);
30 this.isPredicate = isPredicate;
31 this.hasSub = false;
32 }
33
34 public ModelViewerRow(ModelViewer modelViewer, String resource, int level) {
35 expanded = false;
36 isPredicate = false;
37 hasSub = false;
38 this.modelViewer = modelViewer;
39 this.resource = resource;
40 this.level = level;
41 }
42
43 public boolean isExpanded() {
44 return expanded;
45 }
46
47 public void expand() {
48 expanded = !expanded;
49 }
50
51 public boolean isExpandable() {
52 if (!isPredicate) {
53 return hasSub;
54 } else
55 return false;
56 }
57
58 public void setSub(boolean b) {
59 hasSub = b;
60 }
61
62 public boolean isPredicate() {
63 return isPredicate;
64 }
65
66 public String getID() {
67 return getResource();
68 }
69
70 public String getTitle() {
71 if (Definitions.isRDF(getResource())
72 || Tools.isSameNS(modelViewer.getNamespace(), getResource()))
73 return Tools.getName(getResource());
74 else
75 return getResource();
76 }
77
78 public int getIndent() {
79 return level;
80 }
81
82 public boolean isSchemaProperty() {
83 return level == 0 && (modelViewer instanceof SchemaViewer);
84 }
85
86 public String getResource() {
87 return resource.toString();
88 }
89
90 private Resource getResourceObject() {
91 return modelViewer.getModel().getStatementPool().getResource(getResource());
92 }
93
94 protected ModelViewer modelViewer;
95
96 protected String resource;
97
98 protected int level;
99
100 protected boolean expanded;
101
102 protected boolean isPredicate;
103
104 protected boolean hasSub;
105 }