1 |
/* |
/* |
2 |
Loom.java |
DefaultNodeView.java |
3 |
* |
* |
4 |
* Copyright (c) 2003 by Benja Fallenstein |
* Copyright (c) 2003 by Benja Fallenstein |
5 |
* |
* |
26 |
*/ |
*/ |
27 |
package org.fenfire.loom; |
package org.fenfire.loom; |
28 |
import org.nongnu.libvob.*; |
import org.nongnu.libvob.*; |
|
import org.nongnu.libvob.impl.DefaultVobMatcher; |
|
29 |
import org.nongnu.libvob.vobs.*; |
import org.nongnu.libvob.vobs.*; |
30 |
|
|
31 |
import java.awt.*; |
import java.awt.Color; |
32 |
import java.awt.event.*; |
//import java.awt.event.*; |
33 |
import java.io.*; |
//import java.io.*; |
34 |
import java.util.*; |
import java.util.*; |
35 |
import java.util.List; |
import java.util.List; |
36 |
|
|
37 |
import com.hp.hpl.mesa.rdf.jena.model.*; |
import com.hp.hpl.mesa.rdf.jena.model.*; |
38 |
import com.hp.hpl.mesa.rdf.jena.mem.*; |
//import com.hp.hpl.mesa.rdf.jena.mem.*; |
39 |
|
|
40 |
/** The default node view for Loom. |
/** The default node view for Loom. |
41 |
* Not tested at this time [XXX fix!!!]. |
* Not tested at this time [XXX fix!!!]. |
43 |
public class DefaultNodeView implements NodeView { |
public class DefaultNodeView implements NodeView { |
44 |
protected Loom loom; |
protected Loom loom; |
45 |
protected TextStyle style; |
protected TextStyle style; |
46 |
|
protected Vob resourceVob, literalVob, selResourceVob, selLiteralVob; |
47 |
|
|
48 |
public DefaultNodeView(Loom loom) { |
public DefaultNodeView(Loom loom) { |
49 |
this.loom = loom; |
this.loom = loom; |
50 |
style = GraphicsAPI.getInstance() |
style = GraphicsAPI.getInstance() |
51 |
.getTextStyle("Serif", 0, 12); |
.getTextStyle("Serif", 0, 12); |
52 |
|
resourceVob = new OvalBgVob(new Color(102, 255, 102), false, null); |
53 |
|
literalVob = new RectBgVob(new Color(255, 204, 51), false, null); |
54 |
|
selResourceVob = new OvalBgVob(new Color(102, 255, 102), true, |
55 |
|
loom.colors.getCursorBorderColor()); |
56 |
|
selLiteralVob = new RectBgVob(new Color(255, 204, 51), true, |
57 |
|
loom.colors.getCursorBorderColor()); |
58 |
} |
} |
59 |
|
|
60 |
public void render(VobScene sc, int into, Nodespec spec) { |
public void render(VobScene sc, int into, Nodespec spec) { |
61 |
RDFNode node = spec.node; |
RDFNode node = spec.node; |
62 |
Property prop = spec.prop; |
Property prop = spec.prop; |
64 |
|
|
65 |
boolean selected = spec.equals(loom.cursor.getRotationNodespec(dir)); |
boolean selected = spec.equals(loom.cursor.getRotationNodespec(dir)); |
66 |
if(node instanceof Resource) { |
if(node instanceof Resource) { |
67 |
OvalBgVob bg = new OvalBgVob(new Color(102, 255, 102), selected, |
if(selected) |
68 |
loom.colors.getCursorBorderColor()); |
sc.map.put(selResourceVob, into); |
69 |
sc.map.put(bg, into); |
else |
70 |
|
sc.map.put(resourceVob, into); |
71 |
} else { |
} else { |
72 |
RectBgVob bg = new RectBgVob(new Color(255, 204, 51), selected, |
if(selected) |
73 |
loom.colors.getCursorBorderColor()); |
sc.map.put(selLiteralVob, into); |
74 |
sc.map.put(bg, into); |
else |
75 |
|
sc.map.put(literalVob, into); |
76 |
} |
} |
77 |
|
|
78 |
String s; |
String s; |