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

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

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

revision 1.7 by mudyc, Sat May 3 00:57:00 2003 UTC revision 1.8 by benja, Sat May 3 13:35:14 2003 UTC
# Line 5  package org.fenfire.view.buoy; Line 5  package org.fenfire.view.buoy;
5  import org.nongnu.libvob.*;  import org.nongnu.libvob.*;
6  import org.nongnu.libvob.buoy.*;  import org.nongnu.libvob.buoy.*;
7  import org.nongnu.libvob.impl.DefaultVobMatcher;  import org.nongnu.libvob.impl.DefaultVobMatcher;
8    import org.nongnu.libvob.lava.placeable.Placeable;
9  import org.nongnu.alph.*;  import org.nongnu.alph.*;
10  import org.fenfire.*;  import org.fenfire.*;
11  import org.fenfire.swamp.*;  import org.fenfire.swamp.*;
# Line 30  public static final String rcsid = "$Id$ Line 31  public static final String rcsid = "$Id$
31      public AbstractNodeType2D pageImageScrollNodeType;      public AbstractNodeType2D pageImageScrollNodeType;
32      public AbstractNodeType2D normalNodeNodeType;      public AbstractNodeType2D normalNodeNodeType;
33    
34        protected NodeFunction nodeView;
35    
36      // Function: node -> pair(scrollblock, rect)      // Function: node -> pair(scrollblock, rect)
37      private class SB4Node implements NodeFunction {      private class SB4Node implements NodeFunction {
38          public Object f(ConstGraph g, Object node) {          public Object f(ConstGraph g, Object node) {
39              Enfilade1D enf = (Enfilade1D)fen.txtfunc.f(g, node);              Enfilade1D enf = (Enfilade1D)fen.txtfunc.f(g, node);
40              List l = enf.getList();              List l = enf.getList();
41              if(l.size() < 1) return null;              if(l.size() < 1) return null;
42              Span sp = (Span)l.get(0);  
43              if (sp instanceof PageImageSpan) {              PageImageSpan sp;
44                  return new Pair(sp.getScrollBlock(), new Rectangle(0,0,300,300));              try {
45              } else {                  sp = (PageImageSpan)l.get(0);
46                } catch(ClassCastException _) {
47                  return null;                  return null;
48              }              }
49    
50                int x = sp.getLocation().x,
51                    y = sp.getLocation().y,
52                    w = sp.getSize().width,
53                    h = sp.getSize().height;
54    
55                PageScrollBlock b = (PageScrollBlock)sp.getScrollBlock();
56                for(int i=0; i<sp.getPageIndex(); i++)
57                    x += b.getPage(i).getSize().width;
58    
59                return new Pair(b, new Rectangle(x,y,w,h));
60          }          }
61      }      }
62    
63      NodeFunction scrollBlockForNode ;      NodeFunction scrollBlockForNode ;
64    
65    
66      public TransclusionConnector(Fen fen) {      public TransclusionConnector(Fen fen, NodeFunction nodeView) {
67          this.fen = fen;          this.fen = fen;
68          this.scrollBlockForNode = new CachedNodeFunction(1000,          this.scrollBlockForNode = new CachedNodeFunction(1000,
69                      fen.constgraph, new SB4Node());                      fen.constgraph, new SB4Node());
70            this.nodeView = nodeView;
71      }      }
72    
73      public void addBuoys(VobScene vs, int parentCs,      public void addBuoys(VobScene vs, int parentCs,
# Line 120  public static final String rcsid = "$Id$ Line 136  public static final String rcsid = "$Id$
136          }          }
137      }      }
138    
139        public int dx = 30, dy = 30;
140      protected java.awt.Rectangle getRect(Object node) {      protected java.awt.Rectangle getRect(Object node) {
141            if (node == null) throw new Error("Impossible!");
142          int x = RDFUtil.getInt(fen, node, SPATIAL.coordX);          int x = RDFUtil.getInt(fen, node, SPATIAL.coordX);
143          int y = RDFUtil.getInt(fen, node, SPATIAL.coordY);          int y = RDFUtil.getInt(fen, node, SPATIAL.coordY);
144          return new java.awt.Rectangle(x-20, y-20, 240, 140);          Placeable p = (Placeable)nodeView.f(fen.constgraph, node);
145            return new java.awt.Rectangle(x-dx, y-dy,
146                                          (int)p.getWidth()+dx+dx,
147                                          (int)p.getHeight()+dy+dy);
148      }      }
   
   
149  }  }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

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