/[fenfire]/fenfire/org/fenfire/modules/pp/PPCanvasNode.java
ViewVC logotype

Diff of /fenfire/org/fenfire/modules/pp/PPCanvasNode.java

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

revision 1.1 by mudyc, Wed Mar 26 00:36:06 2003 UTC revision 1.2 by mudyc, Wed Mar 26 14:00:24 2003 UTC
# Line 1  Line 1 
1  //(c): Matti J. Katila  //(c): Matti J. Katila
2    
3  package org.fenfire.modules.pp;  package org.fenfire.modules.pp;
4    import org.fenfire.vocab.*;
5    import org.fenfire.util.*;
6  import org.fenfire.view.*;  import org.fenfire.view.*;
7  import org.fenfire.view.buoy.*;  import org.fenfire.view.buoy.*;
8  import org.nongnu.libvob.*;  import org.nongnu.libvob.*;
# Line 16  private static final String rcsid = "$Id Line 18  private static final String rcsid = "$Id
18    
19      private Model model;      private Model model;
20      private GraphicsAPI.Window win;      private GraphicsAPI.Window win;
     private PPVocab PP = new PPVocab();  
21      public PPCanvasNode(Model m, GraphicsAPI.Window w) {      public PPCanvasNode(Model m, GraphicsAPI.Window w) {
22          this.model = m;          this.model = m;
23          this.win = w;          this.win = w;
# Line 26  private static final String rcsid = "$Id Line 27  private static final String rcsid = "$Id
27      /** True if this view "owns" a certain node.      /** True if this view "owns" a certain node.
28       */       */
29      public boolean ownsNode(RDFNode node)      public boolean ownsNode(RDFNode node)
30      { try {      {
31          // check if node is a note          // check if node is a note
32          Selector slctr = new SelectorImpl((Resource)node, RDF.type, (RDFNode) null);          if (ShortRDF.isNodeType(model, node, PP.noteType)) return true;
         StmtIterator iter = model.listStatements(slctr);  
         while (iter.hasNext()) {  
             Statement stmt = iter.next();  
             if (stmt.getSubject() == PP.NoteType) return true;  
         }  
33                    
34          // or if node is a paper          // or if node is a paper
35          slctr = new SelectorImpl((Resource)node, RDF.type, (RDFNode) null);          if (ShortRDF.isNodeType(model, node, PP.paperType)) return true;
         iter = model.listStatements(slctr);  
         while (iter.hasNext()) {  
             Statement stmt = iter.next();  
             if (stmt.getSubject() == PP.PaperType) return true;  
         }  
36                    
37          // otherwise          // otherwise
38          return false;          return false;
39      } catch (RDFException e) {      }
         pa("Exception!: "+e);  
         throw new Error("Error in PPCanvas");  
     }}  
40    
41      /** Get the ideal size for this buoy.      /** Get the ideal size for this buoy.
42       * (mudyc): Just and idea if vobscene width and height is passed in wh...       * (mudyc): Just and idea if vobscene width and height is passed in wh...
# Line 118  private static final String rcsid = "$Id Line 106  private static final String rcsid = "$Id
106    
107    
108      private int[] getCoords(RDFNode node) {      private int[] getCoords(RDFNode node) {
109          try {          int [] ints = new int[2];
110              int [] ints = new int[2];          
111                        ints[0] = ShortRDF.getInt(model, node, SPATIAL.coordX);
112              Selector slctr = new SelectorImpl((Resource)node, PP.CoordX, (RDFNode) null);          ints[1] = ShortRDF.getInt(model, node, SPATIAL.coordY);
113              StmtIterator iter = model.listStatements(slctr);          return ints;
             if (iter.hasNext()) {  
                 Statement stmt = iter.next();  
                 ints[0] = stmt.getInt();  
             }  
               
             slctr = new SelectorImpl((Resource)node, PP.CoordY, (RDFNode) null);  
             iter = model.listStatements(slctr);  
             if (iter.hasNext()) {  
                 Statement stmt = iter.next();  
                 ints[1] = stmt.getInt();  
             }  
   
             return ints;  
         } catch (RDFException e) {  
             pa("Exception!: "+e);  
             throw new Error("Error in PPCanvas");  
         }  
114      }      }
115    
116  }  }

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