39 |
public String newPaper() throws RemoteException |
public String newPaper() throws RemoteException |
40 |
{ synchronized(fen) { |
{ synchronized(fen) { |
41 |
if(dbg) pa("make a new paper"); |
if(dbg) pa("make a new paper"); |
42 |
Object paper = RDFUtil.N(fen, PP.Paper); |
Object paper = RDFUtil.N(fen, CANVAS2D.Canvas); |
43 |
if(dbg) pa("new paper done."); |
if(dbg) pa("new paper done."); |
44 |
|
|
45 |
// set creation time |
// set creation time |
46 |
// XXX we need iso 8601 time presentation here |
// XXX we need iso 8601 time presentation here |
47 |
Literal time = Nodes.getStringLiteral("123"); |
// Literal time = Nodes.getStringLiteral("123"); |
48 |
fen.graph.set1_11X(paper, PP.creationTime, time); |
// fen.graph.set1_11X(paper, PP.creationTime, time); |
49 |
return Nodes.toString(paper); |
return Nodes.toString(paper); |
50 |
}} |
}} |
51 |
|
|
88 |
} |
} |
89 |
|
|
90 |
// note doesn't exist so we need to make one |
// note doesn't exist so we need to make one |
91 |
Object note = RDFUtil.N(fen, PP.Note); |
Object note = Nodes.N(); |
|
//fen.txt.set(note, ((SimpleNodeContent)fen.txt).enfMaker.makeEnfilade( )); |
|
92 |
|
|
93 |
if(dbg) { |
if(dbg) { |
94 |
pa("Before:"); |
pa("Before:"); |
95 |
Iterator iter = fen.constgraph.findN_11X_Iter(paper, PAPER.contains); |
Iterator iter = fen.constgraph.findN_11X_Iter(paper, |
96 |
|
CANVAS2D.contains); |
97 |
while (iter.hasNext()) { |
while (iter.hasNext()) { |
98 |
pa(" "+iter.next()); |
pa(" "+iter.next()); |
99 |
} |
} |
100 |
} |
} |
101 |
|
|
102 |
// and join note to paper |
// and join note to paper |
103 |
fen.graph.add(paper, PAPER.contains, note); |
fen.graph.add(paper, CANVAS2D.contains, note); |
104 |
|
|
105 |
if(dbg) { |
if(dbg) { |
106 |
pa("After:"); |
pa("After:"); |
107 |
Iterator iter = fen.constgraph.findN_11X_Iter(paper, PAPER.contains); |
Iterator iter = fen.constgraph.findN_11X_Iter(paper, |
108 |
|
CANVAS2D.contains); |
109 |
while (iter.hasNext()) { |
while (iter.hasNext()) { |
110 |
pa(" "+iter.next()); |
pa(" "+iter.next()); |
111 |
} |
} |
112 |
} |
} |
113 |
|
|
114 |
// set coords |
// set coords |
115 |
fen.graph.set1_11X(note, SPATIAL.coordX, Nodes.getStringLiteral(""+x) ); |
fen.graph.set1_11X(note, CANVAS2D.x, Nodes.getStringLiteral(""+x) ); |
116 |
fen.graph.set1_11X(note, SPATIAL.coordY, Nodes.getStringLiteral(""+y) ); |
fen.graph.set1_11X(note, CANVAS2D.y, Nodes.getStringLiteral(""+y) ); |
|
|
|
|
// set depth... |
|
|
fen.graph.set1_11X(note, PP.depth, Nodes.getStringLiteral("10") ); |
|
117 |
|
|
118 |
// Set text |
// Set text |
119 |
alphContent.setText(note, text, true); |
alphContent.setText(note, text, true); |
172 |
if (note == null) return; |
if (note == null) return; |
173 |
|
|
174 |
// delete all old coords |
// delete all old coords |
175 |
fen.graph.rm_11A(note, SPATIAL.coordX); |
fen.graph.rm_11A(note, CANVAS2D.x); |
176 |
fen.graph.rm_11A(note, SPATIAL.coordY); |
fen.graph.rm_11A(note, CANVAS2D.y); |
177 |
|
|
178 |
// set coords |
// set coords |
179 |
fen.graph.set1_11X(note, SPATIAL.coordX, Nodes.getStringLiteral(""+x) ); |
fen.graph.set1_11X(note, CANVAS2D.x, Nodes.getStringLiteral(""+x) ); |
180 |
fen.graph.set1_11X(note, SPATIAL.coordY, Nodes.getStringLiteral(""+y) ); |
fen.graph.set1_11X(note, CANVAS2D.y, Nodes.getStringLiteral(""+y) ); |
181 |
}} |
}} |
182 |
|
|
183 |
|
|
195 |
|
|
196 |
if (side < 0) { |
if (side < 0) { |
197 |
// check if already associated |
// check if already associated |
198 |
if (fen.constgraph.contains(assoc, PP.association, note)) { |
if (fen.constgraph.contains(assoc, |
199 |
|
STRUCTLINK.linkedTo, note)) { |
200 |
pa("Already associated!"); |
pa("Already associated!"); |
201 |
return; |
return; |
202 |
} |
} |
203 |
|
|
204 |
// assoc |
// assoc |
205 |
fen.graph.add(assoc, PP.association, note); |
fen.graph.add(assoc, STRUCTLINK.linkedTo, note); |
206 |
} else { |
} else { |
207 |
// check if already associated |
// check if already associated |
208 |
if (fen.constgraph.contains(note, PP.association, assoc)) { |
if (fen.constgraph.contains(note, STRUCTLINK.linkedTo, assoc)) { |
209 |
pa("Already associated!"); |
pa("Already associated!"); |
210 |
return; |
return; |
211 |
} |
} |
212 |
|
|
213 |
// assoc |
// assoc |
214 |
fen.graph.add(note, PP.association, assoc); |
fen.graph.add(note, STRUCTLINK.linkedTo, assoc); |
215 |
} |
} |
216 |
}} |
}} |
217 |
|
|