/* Loom.java * * Copyright (c) 2003 by Benja Fallenstein * * This file is part of Gzz. * * Gzz is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Gzz is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General * Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with Gzz; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * */ /* * Written by Benja Fallenstein */ package gzz.loom; import gzz.client.*; import gzz.vob.*; import gzz.vob.vobs.*; import java.awt.event.MouseEvent; import java.io.*; import java.util.*; import com.hp.hpl.mesa.rdf.jena.model.*; import com.hp.hpl.mesa.rdf.jena.mem.*; /** A sample app loading an RDF file and showing part of it. * Currently used to verify visually that the tests really work. * May become the main Loom app in the future :-) */ public class Loom { public static Model load(String filename) throws RDFException, IOException { Model model = new ModelMem(); model.read(new java.io.FileReader(filename), ""); return model; } public static void main(String[] args) throws RDFException, IOException { final Model model = load(args[0]); final Statement stmt = model.listStatements().next(); final Comparator cmp = new Comparator() { public int compare(Object o1, Object o2) { return o1.hashCode() - o2.hashCode(); } }; final Shower s = new Shower() { Screen screen; public void setScreen(Screen s) { this.screen = s; } public VobScene generate() { VobScene sc = this.screen.window.createVobScene(); SimpleView sv = new SimpleView(cmp); sv.render(sc, 0, stmt.getSubject(), stmt.getObject()); return sc; } public void chg() {} }; final Binder b = new Binder() { public void keystroke(String s) {} public void mouse(MouseEvent m) {} public void setScreen(Screen s) {} public void timeout(Object id) {} public void windowClosed() {} }; final GraphicsAPI api = GraphicsAPI.getInstance(); api.startUpdateManager(new Runnable() { public void run() { Screen scr = new Screen(api.createWindow(), b, s); AbstractUpdateManager.addWindow(scr); scr.window.setLocation(0, 0, 300, 300); AbstractUpdateManager.chg(); } }); } }