/[fenfire]/fenfire/org/fenfire/view/buoy/TTConnector.java
ViewVC logotype

Diff of /fenfire/org/fenfire/view/buoy/TTConnector.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by tjl, Mon Aug 11 09:14:05 2003 UTC revision 1.2 by tjl, Mon Aug 11 11:07:27 2003 UTC
# Line 1  Line 1 
1  // (c) Tuomas J. Lukka  // (c) Tuomas J. Lukka
2    
3  package org.fenfire.view.buoy;  package org.fenfire.view.buoy;
4    import java.util.Iterator;
5  import org.fenfire.*;  import org.fenfire.*;
6  import org.fenfire.swamp.*;  import org.fenfire.swamp.*;
7  import org.fenfire.view.*;  import org.fenfire.view.*;
# Line 14  import org.nongnu.libvob.impl.DefaultVob Line 15  import org.nongnu.libvob.impl.DefaultVob
15  import org.nongnu.alph.*;  import org.nongnu.alph.*;
16    
17  /** A Buoy connector for TreeTime.  /** A Buoy connector for TreeTime.
18     * XXX Generalize to general page / block relation!
19     * Note that this connector gives a null anchor.
20   */   */
21  public class TTConnector implements BuoyViewConnector {  public class TTConnector implements BuoyViewConnector {
22      public static boolean dbg = false;      public static boolean dbg = false;
23      private static void p(String s) { System.out.println("TTConnector:: "+s); }      private static void p(String s) { System.out.println("TTConnector:: "+s); }
24    
25        private Fen fen;
26        private Object relation;
27    
28        public AbstractNodeType2D pageImageScrollNodeType;
29        public AbstractNodeType2D normalNodeNodeType;
30    
31        public TTConnector(Fen fen, Object relation) {
32            this.fen = fen;
33            this.relation = relation;
34        }
35    
36        private void addBuoy(VobScene vs, Object node, int direction,
37                            BuoyLinkListener l) {
38            String s = Nodes.toString(node);
39            if(s.startsWith("urn:x-storm:1.0:application/pdf") ||
40               s.startsWith("urn:x-storm:1.0:application/postscript")) {
41                if(dbg) p("Got "+s+" was pagescroll " + direction);
42            } else {
43                if(dbg) p("Got "+s+" was plane " + direction);
44            }
45        }
46    
47      public void addBuoys(VobScene vs, int parentCs,      public void addBuoys(VobScene vs, int parentCs,
48                           BuoyViewMainNode mainNode0,                           BuoyViewMainNode mainNode0,
49                           BuoyLinkListener l) {                           BuoyLinkListener l) {
# Line 30  public class TTConnector implements Buoy Line 55  public class TTConnector implements Buoy
55          // 1) a PageScrollBlock, or          // 1) a PageScrollBlock, or
56          // 2) a canvas.          // 2) a canvas.
57                    
58            Object node;
59            
60          if(plane instanceof PageScrollBlock) {          if(plane instanceof PageScrollBlock) {
61              PageScrollBlock sb = (PageScrollBlock)plane;              PageScrollBlock sb = (PageScrollBlock)plane;
62              if(dbg) p("Scrollblock: "+sb.getID());              if(dbg) p("Scrollblock: "+sb.getID());
63                node = Nodes.get(sb.getID());
64          } else {          } else {
65              if(dbg) p("Plane: "+plane);              if(dbg) p("Plane: "+plane);
66                node = plane;
67            }
68    
69            for(
70                Iterator ileft = fen.constgraph.findN_11X_Iter(node, relation);
71                ileft.hasNext();) {
72                Object linknode = ileft.next();
73                addBuoy(vs, linknode, -1, l);
74          }          }
75            
76    
77            for(
78                Iterator iright = fen.constgraph.findN_X11_Iter(relation, node);
79                iright.hasNext();) {
80                Object linknode = iright.next();
81                addBuoy(vs, linknode, 1, l);
82            }
83    
84            
85    
86      }      }
87  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26