document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. /**
  2.  * Script Node class implementation, specific for use by ScriptService as part of the object model.
  3.  * <p>
  4.  * The class exposes Node properties, children and assocs as dynamically populated maps and lists. The various collection classes are mirrored as JavaScript properties. So can be
  5.  * accessed using standard JavaScript property syntax, such as <code>node.children[0].properties.name</code>.
  6.  * <p>
  7.  * Various helper methods are provided to access common and useful node variables such as the content url and type information.
  8.  *
  9.  * @author Kevin Roast
  10.  */
  11. public class ScriptNode implements Serializable, Scopeable, NamespacePrefixResolverProvider{
  12.     /* ... */
  13.    
  14.     /** Text fragments with highlighted search keywords, only needed when in the context of a search */
  15.     private Scriptable fragments = null;    
  16.    
  17.     /* ... */
  18.    
  19.     public Scriptable getFragments(){          
  20.         return fragments;
  21.     }
  22.    
  23.     public void setFragments (String [] fragments){
  24.         if(fragments == null){
  25.             this.fragments = Context.getCurrentContext().newArray(this.scope, new Object[0]);
  26.             return;
  27.         }
  28.        
  29.         Object[] frgArray = new Object[fragments.length];
  30.         int index = 0;
  31.         for (String fragment : fragments){
  32.             frgArray[index++] = fragment;
  33.         }
  34.         this.fragments = Context.getCurrentContext().newArray(this.scope, frgArray);
  35.     }
  36.    
  37.     /* ... */
  38.    
  39.     /**
  40.      * Reset the Node cached state
  41.      */
  42.     public void reset(){
  43.         /* ... */
  44.         this.fragments = null;
  45.        
  46.     /* ... */
');