public void moveLastChild ( Row newParent ) { if ( this == newParent ) return ; // remove from its current position Row parentItem = m_parent ; if ( parentItem == null ) parentItem = this . treeTable . m_rootItem ; parentItem . getChilds ( ) . remove ( this ) ; // DOM.removeChild( m_body, m_tr ); if ( newParent == null ) newParent = this . treeTable . m_rootItem ; // insert at the end of the current parent // DOM add Row lastLeaf = newParent . getLastLeaf ( ) ; Element trToInsertAfter = lastLeaf . m_tr ; if ( trToInsertAfter != null ) { int after = DOM . getChildIndex ( this . treeTable . m_body , trToInsertAfter ) ; int before = after + 1 ; DOM . insertChild ( this . treeTable . m_body , m_tr , before ) ; } else { DOM . appendChild ( this . treeTable . m_body , m_tr ) ; } parentItem . getChilds ( ) . add ( this ) ; // take care of the left padding Element firstTd = DOM . getChild ( m_tr , 0 ) ; firstTd . getStyle ( ) . setPaddingLeft ( getLevel ( ) * this . treeTable . treePadding , Unit . PX ) ; }
move to be the last item of parent