public void setIndex ( int index ) { ElementBase parent = getParent ( ) ; if ( parent == null ) { CWFException . raise ( "Element has no parent." ) ; } int currentIndex = parent . children . indexOf ( this ) ; if ( currentIndex < 0 || currentIndex == index ) { return ; } parent . moveChild ( currentIndex , index ) ; }
Sets this element s index to the specified value . This effectively changes the position of the element relative to its siblings .