org.netbeans.modules.xml.xdm/1 1.19.0 1

org.netbeans.modules.xml.xdm.visitor
Class Utils

java.lang.Object
  extended by org.netbeans.modules.xml.xdm.visitor.Utils

public class Utils
extends Object

Utils.java Created on November 16, 2004, 3:21 PM


Constructor Summary
Utils()
           
 
Method Summary
static String filterEndLines(String str)
          Filter characters #13 (CR) from the specified String
static BaseDocument loadDocument(String text)
           
static NodeList parseFragment(String text)
           
static void replaceDocument(Document doc, String newDoc)
           
static void replaceDocument(Document doc, String newDoc, String prefixMark)
          This method update document in editor after change in beans hierarchy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utils

public Utils()
Method Detail

replaceDocument

public static void replaceDocument(Document doc,
                                   String newDoc,
                                   String prefixMark)
                            throws BadLocationException
This method update document in editor after change in beans hierarchy. It takes old document and new document in String. To avoid regeneration of whole document in text editor following steps are done: 1) compare the begin of both documents (old one and new one) - find the first position where both documents differ 2) do the same from the ends of documents 3) remove old middle part of text (modified part) and insert new one

Parameters:
doc - original document
newDoc - new value of whole document
prefixMark - - beginning part of the document before this mark should be preserved
Throws:
BadLocationException

replaceDocument

public static void replaceDocument(Document doc,
                                   String newDoc)
                            throws BadLocationException
Throws:
BadLocationException

filterEndLines

public static String filterEndLines(String str)
Filter characters #13 (CR) from the specified String

Parameters:
str - original string
Returns:
the string without #13 characters

loadDocument

public static BaseDocument loadDocument(String text)
                                 throws IOException
Throws:
IOException

parseFragment

public static NodeList parseFragment(String text)
                              throws IOException
Throws:
IOException

org.netbeans.modules.xml.xdm/1 1.19.0 1

Built on May 25 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.