Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Script Node class implementation, specific for use by ScriptService as part of the object model.
- * <p>
- * 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
- * accessed using standard JavaScript property syntax, such as <code>node.children[0].properties.name</code>.
- * <p>
- * Various helper methods are provided to access common and useful node variables such as the content url and type information.
- *
- * @author Kevin Roast
- */
- public class ScriptNode implements Serializable, Scopeable, NamespacePrefixResolverProvider{
- /* ... */
- /** Text fragments with highlighted search keywords, only needed when in the context of a search */
- private Scriptable fragments = null;
- /* ... */
- public Scriptable getFragments(){
- return fragments;
- }
- public void setFragments (String [] fragments){
- if(fragments == null){
- this.fragments = Context.getCurrentContext().newArray(this.scope, new Object[0]);
- return;
- }
- Object[] frgArray = new Object[fragments.length];
- int index = 0;
- for (String fragment : fragments){
- frgArray[index++] = fragment;
- }
- this.fragments = Context.getCurrentContext().newArray(this.scope, frgArray);
- }
- /* ... */
- /**
- * Reset the Node cached state
- */
- public void reset(){
- /* ... */
- this.fragments = null;
- /* ... */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement