[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] fenfire/org/fenfire/loom Loom.java DefaultNodeV...
From: |
Benja Fallenstein |
Subject: |
[Gzz-commits] fenfire/org/fenfire/loom Loom.java DefaultNodeV... |
Date: |
Sat, 22 Mar 2003 15:18:55 -0500 |
CVSROOT: /cvsroot/fenfire
Module name: fenfire
Changes by: Benja Fallenstein <address@hidden> 03/03/22 15:18:55
Modified files:
org/fenfire/loom: Loom.java
Added files:
org/fenfire/loom: DefaultNodeView.java LoomBindings.java
Log message:
Move code
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/loom/DefaultNodeView.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/loom/LoomBindings.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/loom/Loom.java.diff?tr1=1.41&tr2=1.42&r1=text&r2=text
Patches:
Index: fenfire/org/fenfire/loom/Loom.java
diff -u fenfire/org/fenfire/loom/Loom.java:1.41
fenfire/org/fenfire/loom/Loom.java:1.42
--- fenfire/org/fenfire/loom/Loom.java:1.41 Fri Mar 21 09:50:32 2003
+++ fenfire/org/fenfire/loom/Loom.java Sat Mar 22 15:18:55 2003
@@ -154,97 +154,7 @@
final GraphicsAPI api = GraphicsAPI.getInstance();
- final TextStyle style = api.getTextStyle("Serif", 0, 12);
- view = new ViewSettings(new NodeView() {
- public void render(VobScene sc, int into, Nodespec spec) {
- RDFNode node = spec.node;
- Property prop = spec.prop;
- int dir = spec.dir;
-
- boolean selected =
spec.equals(cursor.getRotationNodespec(dir));
- if(node instanceof Resource) {
- OvalBgVob bg = new OvalBgVob(new Color(102, 255, 102),
selected,
-
colors.getCursorBorderColor());
- sc.map.put(bg, into);
- } else {
- RectBgVob bg = new RectBgVob(new Color(255, 204, 51),
selected,
-
colors.getCursorBorderColor());
- sc.map.put(bg, into);
- }
-
- String s;
- boolean isByClass = false;
- if(node instanceof Literal) {
- try {
- s = ((Literal)node).getString();
- } catch(RDFException e) {
- System.out.println(e);
- s = "<Error>";
- }
- } else {
- s = ((Resource)node).getURI();
- if(s != null)
- s = cursor.names.getAbbrev(s);
- else
- s = "";
- String t = s;
-
- try {
- Property by;
-
- try {
- Statement typeStmt =
- ((Resource)node).getProperty(rdf.type);
- RDFNode type = typeStmt.getObject();
- by = (Property)showClassBy.get(type);
- } catch(RDFException _) {
- by = showNoClassBy;
- }
-
- if(by != null) {
- Statement byStmt =
((Resource)node).getProperty(by);
- if(byStmt.getObject() instanceof Literal)
- s = byStmt.getString();
- else
- s =
cursor.names.getAbbrev(byStmt.getObject().toString());
-
- isByClass = true;
- }
- } catch(RDFException e) {
- s = t;
- }
- }
-
- if(s.length() > 17) {
- if(node instanceof Literal || isByClass)
- s = s.substring(0, 14) + "...";
- else
- s = "..." + s.substring(s.length()-14);
- }
-
- float w = style.getWidth(s, 1);
- float h = style.getHeight(1);
- float x = 75-w/2;
- float y = 10-h/2;
-
- int textCs = sc.orthoCS(into, "text", 0, x, y, h, h);
- sc.map.put(new TextVob(style, s), textCs);
-
- if(prop != null) {
- s = prop.toString();
- s = cursor.names.getAbbrev(s);
- if(s.length() > 15) s = s.substring(s.length()-15);
- if(dir > 0)
- x = 0;
- else
- x = 150 - style.getWidth(s, .8f);
- h = style.getHeight(.8f);
- int propCs = sc.orthoCS(into, "property",
- 0, x, -h, h, h);
- sc.map.put(new TextVob(style, s), propCs);
- }
- }
- });
+ view = new ViewSettings(new DefaultNodeView(this));
final Shower s = new Shower() {
Screen screen;
public void setScreen(Screen s) {
@@ -283,90 +193,7 @@
}
public void chg() {}
};
- final Binder b = new Binder() {
- Screen screen;
-
- public void keystroke(String s) {
- System.out.println("Keystroke: "+s);
- if(s.equals("Ctrl-Q"))
- System.exit(0);
- if(model == null) return;
-
- if(view.isWheelView()) {
- if(s.equals("i") || s.equals("Up") ||
- s.equals(",") || s.equals("Down")) return;
- if(s.equals("m") || s.equals("n") || s.equals("o"))
- s = "Up";
- else if(s.equals("u") || s.equals("."))
- s = "Down";
- } else if(view.isSimpleView()) {
- if(s.equals("u") || s.equals("o"))
- s = "Up";
- else if(s.equals("m") || s.equals("n") || s.equals("."))
- s = "Down";
- }
-
- if(s.equals("Ctrl-G"))
- showGoToDialog();
- else if(s.equals("i") || s.equals("Up"))
- cursor.rotate(-1);
- else if(s.equals(",") || s.equals("Down"))
- cursor.rotate(1);
- else if(s.equals("j") || s.equals("Left")) {
- RDFNode node = cursor.getRotationNode(-1);
- if(node == null || !(node instanceof Resource)) return;
- lastFocus = new NodeView.Nodespec(cursor.focus);
- List l = new ArrayList(cursor.getConnections(-1));
- Statement stmt =
- (Statement)l.get(cursor.getRotationIndex(-1));
- lastRotation =
- new NodeView.Nodespec(stmt.getSubject(),
- stmt.getPredicate(), -1);
- cursor.move(-1);
- } else if(s.equals("l") || s.equals("Right")) {
- RDFNode node = cursor.getRotationNode(1);
- if(node == null || !(node instanceof Resource)) return;
- lastFocus = new NodeView.Nodespec(cursor.focus);
- List l = new ArrayList(cursor.getConnections(1));
- Statement stmt =
- (Statement)l.get(cursor.getRotationIndex(1));
- lastRotation =
- new NodeView.Nodespec(stmt.getObject(),
- stmt.getPredicate(), 1);
- cursor.move(1);
- } else if(s.equals("PgUp")) // previous view wanted
- view.changeView(-1);
- else if(s.equals("PgDown")) // next view wanted
- view.changeView(1);
-
- AbstractUpdateManager.chg();
- }
- public void mouse(MouseEvent m) {
- if(m.getID() != m.MOUSE_CLICKED) return;
-
- VobScene vs = screen.getVobSceneForEvents();
- int cs = vs.coords.getCSAt(0, m.getX(), m.getY(),
- null);
- if(cs < 0) return;
- Object key = vs.matcher.getKey(cs);
- NodeView.Nodespec spec = (NodeView.Nodespec)key;
- if((m.getModifiers() & m.BUTTON3_MASK) > 0 ||
- spec.node instanceof Literal) {
- cursor.set(cursor.focus, spec.dir, spec.node);
- AbstractUpdateManager.chg();
- } else {
- lastFocus = new NodeView.Nodespec(cursor.focus);
- lastRotation = spec;
- cursor.set((Resource)spec.node, -spec.dir,
cursor.focus);
- AbstractUpdateManager.chg();
- }
- }
- public void setScreen(Screen s) { this.screen = s; }
- public void timeout(Object id) {}
- public void windowClosed() {
- System.exit(0);
- }
- };
+ final Binder b = new LoomBindings(this);
api.startUpdateManager(new Runnable() {
public void run() {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] fenfire/org/fenfire/loom Loom.java DefaultNodeV...,
Benja Fallenstein <=