43 |
*/ |
*/ |
44 |
public class Loom { |
public class Loom { |
45 |
|
|
46 |
|
protected Class[] viewclasses = { |
47 |
|
SimpleView.class, |
48 |
|
WheelView.class |
49 |
|
}; |
50 |
|
int viewcur = 0; |
51 |
|
|
52 |
public static Model load(String filename) throws RDFException, |
public static Model load(String filename) throws RDFException, |
53 |
IOException { |
IOException { |
54 |
Model model = new ModelMem(); |
Model model = new ModelMem(); |
58 |
|
|
59 |
public static void main(String[] args) throws RDFException, IOException { |
public static void main(String[] args) throws RDFException, IOException { |
60 |
String file = ""; |
String file = ""; |
|
boolean wheel = false; |
|
61 |
|
|
62 |
if(args.length < 1) { |
if(args.length < 1) { |
63 |
System.err.println("No filename given"); |
System.err.println("No filename given"); |
64 |
System.exit(1); |
System.exit(1); |
65 |
} else if(args.length == 1) { |
} else if(args.length == 1) { |
66 |
file = args[0]; |
file = args[0]; |
|
} else if(args[0].equals("-w")) { |
|
|
wheel = true; |
|
|
file = args[1]; |
|
67 |
} else { |
} else { |
68 |
System.err.println("Don't understand parameters"); |
System.err.println("Don't understand parameters"); |
69 |
System.exit(1); |
System.exit(1); |
70 |
} |
} |
71 |
|
|
72 |
new Loom(file, wheel); |
new Loom(file); |
73 |
} |
} |
74 |
|
|
75 |
public Loom(String file, boolean wheel) throws RDFException, IOException { |
public Loom(String file) throws RDFException, IOException { |
76 |
|
|
77 |
final Model model = load(file); |
final Model model = load(file); |
78 |
final Statement stmt = model.listStatements().next(); |
final Statement stmt = model.listStatements().next(); |
102 |
sc.unitSqCS(into, "text")); |
sc.unitSqCS(into, "text")); |
103 |
} |
} |
104 |
}; |
}; |
|
View view0; |
|
|
if(!wheel) view0 = new SimpleView(nodeView); |
|
|
else view0 = new WheelView(nodeView); |
|
|
final View view = view0; |
|
105 |
final Shower s = new Shower() { |
final Shower s = new Shower() { |
106 |
Screen screen; |
Screen screen; |
107 |
public void setScreen(Screen s) { |
public void setScreen(Screen s) { |
110 |
public VobScene generate() { |
public VobScene generate() { |
111 |
VobScene sc = this.screen.window.createVobScene(); |
VobScene sc = this.screen.window.createVobScene(); |
112 |
sc.map.put(new SolidBgVob(java.awt.Color.white), 0); |
sc.map.put(new SolidBgVob(java.awt.Color.white), 0); |
113 |
|
View view; |
114 |
|
try { |
115 |
|
view = (View) viewclasses[viewcur] |
116 |
|
.getConstructor(new Class[] {NodeView.class}) |
117 |
|
.newInstance(new Object[] {nodeView}); |
118 |
|
} catch (Exception e) { |
119 |
|
e.printStackTrace(); |
120 |
|
return null; |
121 |
|
} |
122 |
|
|
123 |
view.render(sc, 0, cursor); |
view.render(sc, 0, cursor); |
124 |
return sc; |
return sc; |
125 |
} |
} |
136 |
cursor.move(-1); |
cursor.move(-1); |
137 |
else if(s.equals("Right")) |
else if(s.equals("Right")) |
138 |
cursor.move(1); |
cursor.move(1); |
139 |
|
else if(s.equals("PgUp")) // previous view wanted |
140 |
|
viewcur = (viewcur-1+viewclasses.length) |
141 |
|
% viewclasses.length; |
142 |
|
else if(s.equals("PgDown")) // next view wanted |
143 |
|
viewcur = (viewcur+1) % viewclasses.length; |
144 |
|
|
145 |
AbstractUpdateManager.chg(); |
AbstractUpdateManager.chg(); |
146 |
} |
} |