| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsk.uniba.euromath.document.DocumentModifyHelper
public final class DocumentModifyHelper
Provides basic editing features, document modification driven by schema.
| Constructor Summary | |
|---|---|
| DocumentModifyHelper(XMLAccess xmlAccess)Constuctor. | |
| Method Summary | |
|---|---|
|  String | canDecloseNodes(Element e)Test if element can be declosed. | 
|  String | canDeleteAttribute(Attr attr)Tests if given attribute can be deleted. | 
|  String | canDeleteElements(Set<Element> elements,
                  Node parent)Tests if elements can bedelted | 
|  String | canEncloseNodes(DomPointer start,
                DomPointer end,
                INameList<NewElementRule> outElements)Tests if nodes can be enclosed. | 
|  String | canInsertComment(DomPointer pointer)Tests if comment can be inserted. | 
|  String | canInsertFragment(DomPointer ptr,
                  DocumentFragment fragment)Tests if fragment can be inserted. | 
|  String | canInsertProcessingInstruction(DomPointer pointer)Tests if processing instruction can be inserted. | 
|  String | canInsertTextAt(DomPointer ptr,
                String string)Tests if text can be inserted. | 
|  String | checkInEntity(DomPointer ptr)Checks if given pointer points into entity. | 
|  String | checkInEntity(Node node)Checks if given node is in entity. | 
|  boolean | checkInEntity(Shell shell,
              DomPointer ptr)Checks if given pointer points into entity. | 
|  boolean | checkInEntity(Shell shell,
              Node node)Checks if given node is in entity. | 
|  void | decloseNodes(Shell parent,
             Element e)Manages the process of declosing the nodes - replaces given element with its contents. | 
|  void | deleteAttribute(Shell parent,
                Attr attr)Manages the process of deleting the attribute. | 
|  void | deleteElements(Shell shell,
               Set<Element> elements)Manages the process of deleting the elements. | 
|  void | deleteNode(Shell shell,
           Node node)Tries to delete a single node. | 
|  void | deleteReplaceText(Shell shell,
                  DOMInterval cut,
                  String replaceWith)Tries to delete text from specified location. | 
|  void | deleteTextNode(Shell shell,
               Node node)Deletes given text node by wizard. | 
|  void | encloseNodes(Shell parent,
             DomPointer start,
             DomPointer end)Manages the process of enclosing the nodes. | 
|  List<QName> | getDomQnames(DisplayableNameList dnl)Computes QNames of elements from DisplayableNameList. | 
|  List<QName> | getInsertableElementsQNames(DomPointer pointer)Computes list of names of elements, insertable at given pointer. | 
|  List<String> | getInsertableEntities(Shell parent,
                      DomPointer ptr)Computes insertable entities. | 
|  void | insertComment(Shell shell,
              DomPointer pointer)Inserts processing instruction at pointer. | 
|  void | insertComment(String text,
              Shell shell,
              DomPointer pointer)Inserts comment with text text at pointer. | 
|  void | insertEntity(Shell parent,
             DomPointer ptr)Manages the process of inserting an entity into selected position by dialog. | 
|  void | insertEntity(String entityName,
             DomPointer ptr)Inserts entity to given position. | 
|  void | insertFragment(Shell shell,
               DomPointer ptr,
               DocumentFragment fragment)Tries to insert given document fragment into given position. | 
|  void | insertNewAttribute(Shell parent,
                   Element e)Manages the process of inserting a new attribute into given element by wizard. | 
|  void | insertProcessingInstruction(Shell shell,
                            DomPointer pointer)Inserts processing instruction at pointer. | 
|  void | insertTextAt(Shell shell,
             DomPointer ptr,
             String string,
             short type)Tries to insert text at specified location. | 
|  void | insertTextNode(Shell shell,
               DomPointer point,
               short nodeType)Inserts text to given point. | 
|  void | modifyAttribute(Shell parent,
                Attr attr)Manages the process of modifying the attribute value by wizard. | 
|  void | modifyComment(Shell shell,
              Comment comment)Modifies comment node by dialog. | 
|  void | modifyProcessingInstruction(Shell shell,
                            ProcessingInstruction pi)Modifies processing instruction node by dialog. | 
|  void | modifyTextNode(Shell shell,
               Node node)Modifies text of node by dialog. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public DocumentModifyHelper(XMLAccess xmlAccess)
xmlAccess - the document instance.| Method Detail | 
|---|
public void insertNewAttribute(Shell parent,
                               Element e)
                        throws ExportException
parent - parent window. Should not be null.e - the element where to insert new attribute.
ExportException - when document modification finalization fails.
public void modifyAttribute(Shell parent,
                            Attr attr)
                     throws ExportException
parent - parent window. Should not be null.attr - the attribute whose value has to be modified.
ExportException - when document modification finalization fails.public String canDeleteAttribute(Attr attr)
tested - attribute
public void deleteAttribute(Shell parent,
                            Attr attr)
                     throws ExportException
parent - parent window. Should not be null.attr - the attribute which has to be deleted.
ExportException - when document modification finalization fails.
public String canDeleteElements(Set<Element> elements,
                                Node parent)
elements - to testparent - -
                output argument, method computes common parent of
                elements and stores it in parent
public void deleteElements(Shell shell,
                           Set<Element> elements)
                    throws ExportException
shell - parent window. Should not be null.elements - set of Element s that must be deleted.
ExportException - when document modification finalization fails.
public String canEncloseNodes(DomPointer start,
                              DomPointer end,
                              INameList<NewElementRule> outElements)
start - start of the interval. Must point before the
                end parameter.end - end of the interval.outElements - -
                output argument, method computes elements that are
                allowed by schema to enclose interval
public void encloseNodes(Shell parent,
                         DomPointer start,
                         DomPointer end)
                  throws ExportException
start - start of the interval. Must point before the
                end parameter.end - end of the interval.parent - parent window. Should not be null.
ExportException - when document modification finalization fails.public String canDecloseNodes(Element e)
e - element to declose
public void decloseNodes(Shell parent,
                         Element e)
                  throws ExportException
parent - parent window. Should not be null.e - the element, that shall be replaced by its children if
                the declosing is allowed.
ExportException - when document modification finalization fails.public String canInsertProcessingInstruction(DomPointer pointer)
pointer - 
public void insertProcessingInstruction(Shell shell,
                                        DomPointer pointer)
                                 throws ExportException
shell - parent window. !!! Cannot be null.pointer - dom pointer where to insert
ExportException
public void modifyProcessingInstruction(Shell shell,
                                        ProcessingInstruction pi)
                                 throws ExportException
shell - parent window. !!! Cannot be null.node - processing instruction node to modify
ExportExceptionpublic String canInsertComment(DomPointer pointer)
pointer - 
public void insertComment(Shell shell,
                          DomPointer pointer)
                   throws ExportException
shell - parent window. !!! Cannot be null.pointer - dom pointer where to insert
ExportException
public void insertComment(String text,
                          Shell shell,
                          DomPointer pointer)
                   throws ExportException
text - text of comment to insertshell - parent window. !!! Cannot be null.pointer - dom pointer where to insert
ExportException
public void modifyComment(Shell shell,
                          Comment comment)
                   throws ExportException
shell - parent window. !!! Cannot be null.node - comment node to modify
ExportException
public void insertEntity(Shell parent,
                         DomPointer ptr)
                  throws ExportException
ptr - the desired place.parent - parent window. Should not be null.
ExportException - when document modification finalization fails.
public void insertEntity(String entityName,
                         DomPointer ptr)
                  throws ExportException
entityName - the entity name.ptr - the insert point.
ExportException - if document modification finalization fails.
public List<String> getInsertableEntities(Shell parent,
                                          DomPointer ptr)
ptr - the desired place.parent - parent window. Can be null.
null if no entities are suitable.public List<QName> getInsertableElementsQNames(DomPointer pointer)
pointer - 
public List<QName> getDomQnames(DisplayableNameList dnl)
dnl - the list. If null then empty list is
                returned.
best prefixes.
public void insertTextNode(Shell shell,
                           DomPointer point,
                           short nodeType)
                    throws ExportException
point - insert the text here.shell - parent window. !!! Cannot be null.nodeType - the type of node to insert. May be
                Node.CDATA_SECTION_NODE or
                Node.TEXT_NODE only.
ExportException
public void modifyTextNode(Shell shell,
                           Node node)
                    throws ExportException
node - must be text nodeshell - parent window. !!!Cannot be null.
ExportException - if document fails to transform.
public boolean checkInEntity(Shell shell,
                             Node node)
shell - parent, should not be null.node - node to check
true if node is in entity, false
         otherwise.
public boolean checkInEntity(Shell shell,
                             DomPointer ptr)
shell - parent, should not be null.ptr - the pointer to check
true if the pointer points into an entity,
         false otherwise.public String checkInEntity(Node node)
node - node to check
not null if node is in entity,
         null otherwise.public String checkInEntity(DomPointer ptr)
ptr - the pointer to check
not null if node is in entity,
         null otherwise.
public void deleteTextNode(Shell shell,
                           Node node)
                    throws ExportException
shell - parent window, should not be null.node - node to delete, must not be null. May
                be text, cdata or pure-text entity only.
ExportException - if shit happens.
public void deleteNode(Shell shell,
                       Node node)
                throws ExportException
shell - parent shell, should not be null.node - node to delete.
ExportException - if shit happens.
public String canInsertFragment(DomPointer ptr,
                                DocumentFragment fragment)
ptr - place of insertionfragment - to insert
public void insertFragment(Shell shell,
                           DomPointer ptr,
                           DocumentFragment fragment)
                    throws ExportException
shell - parent shell, should not be null.ptr - the pointer where the fragment will be inserted. Must
                not be null.fragment - the fragment to insert. A clone of this fragment is
                inserted hence the fragment is not modified by this
                method. Must not be null.
ExportException
public String canInsertTextAt(DomPointer ptr,
                              String string)
ptr - place of insertionstring - to insert
public void insertTextAt(Shell shell,
                         DomPointer ptr,
                         String string,
                         short type)
                  throws ExportException
shell - parent shell, should not be null.ptr - the pointer where the fragment will be inserted. Must
                not be null.string - a string to insert.type - the type of node, Node.TEXT_NODE or
                Node.CDATA_SECTION_NODE.
ExportException
public void deleteReplaceText(Shell shell,
                              DOMInterval cut,
                              String replaceWith)
                       throws ExportException
shell - parent shell, should not be null.cut - the interval denoting text being deleted or replaced.
                Must not be null. Caller must ensure
                that there are no elements covered by this interval.
                between the two pointers.replaceWith - a string that will replace given interval, may be
                null.
ExportException| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||