@Deprecated protected void insertAtBoundry(JEditorPane editor,HTMLDocument doc,int offset,Element insertElement,String html,HTML.Tag parentTag,HTML.Tag addTag){
  Element e;
  Element commonParent;
  boolean isFirst=(offset == 0);
  if (offset > 0 || insertElement == null) {
    e=doc.getDefaultRootElement();
    while (e != null && e.getStartOffset() != offset && !e.isLeaf()) {
      e=e.getElement(e.getElementIndex(offset));
    }
    commonParent=(e != null) ? e.getParentElement() : null;
  }
 else {
    commonParent=insertElement;
  }
  if (commonParent != null) {
    int pops=0;
    int pushes=0;
    if (isFirst && insertElement != null) {
      e=commonParent;
      while (e != null && !e.isLeaf()) {
        e=e.getElement(e.getElementIndex(offset));
        pops++;
      }
    }
 else {
      e=commonParent;
      offset--;
      while (e != null && !e.isLeaf()) {
        e=e.getElement(e.getElementIndex(offset));
        pops++;
      }
      e=commonParent;
      offset++;
      while (e != null && e != insertElement) {
        e=e.getElement(e.getElementIndex(offset));
        pushes++;
      }
    }
    pops=Math.max(0,pops - 1);
    insertHTML(editor,doc,offset,html,pops,pushes,addTag);
  }
}

@ Deprecated protected void insertAtBoundry ( JEditorPane editor , HTMLDocument doc , int offset , Element insertElement , String html , HTML . Tag parentTag , HTML . Tag addTag ) { Element e ; Element commonParent ; boolean isFirst = ( offset == 0 ) ; if ( offset > 0 || insertElement == null ) { e = doc . getDefaultRootElement ( ) ; while ( e != null && e . getStartOffset ( ) != offset && ! e . isLeaf ( ) ) { e = e . getElement ( e . getElementIndex ( offset ) ) ; } commonParent = ( e != null ) ? e . getParentElement ( ) : null ; } else { commonParent = insertElement ; } if ( commonParent != null ) { int pops = 0 ; int pushes = 0 ; if ( isFirst && insertElement != null ) { e = commonParent ; while ( e != null && ! e . isLeaf ( ) ) { e = e . getElement ( e . getElementIndex ( offset ) ) ; pops ++ ; } } else { e = commonParent ; offset -- ; while ( e != null && ! e . isLeaf ( ) ) { e = e . getElement ( e . getElementIndex ( offset ) ) ; pops ++ ; } e = commonParent ; offset ++ ; while ( e != null && e != insertElement ) { e = e . getElement ( e . getElementIndex ( offset ) ) ; pushes ++ ; } } pops = Math . max ( 0 , pops - 1 ) ; insertHTML ( editor , doc , offset , html , pops , pushes , addTag ) ; } }
this is invoked when inserting at a boundary . it determines the number of pops , and then the number of pushes that need to be performed , and then invokes inserthtml .
