/** * Removes an element from the band. * * @param e * the element to be removed. * @throws NullPointerException * if the given element is null. */ public void removeElement( final Element e ) { if ( e == null ) { throw new NullPointerException(); } if ( e.getParentSection() != this ) { // this is none of my childs, ignore the request ... return; } if ( allElements == null ) { return; } e.setParent( null ); allElements.remove( e ); allElementsCached = null; notifyNodeChildRemoved( e ); }
public void setElementAt( final int position, final Element element ) { if ( position < 0 ) { throw new IllegalArgumentException( "Position < 0" ); } if ( position >= getElementCount() ) { throw new IllegalArgumentException( "Position >= size" ); } if ( element == null ) { throw new NullPointerException( "Band.addElement(...): element is null." ); } validateLooping( element ); if ( unregisterParent( element ) ) { return; } if ( allElements == null ) { throw new IllegalStateException( "The throws above should have caught that state" ); } // add the element, update the childs Parent and the childs stylesheet. final Element o = allElements.set( position, element ); o.setParent( null ); allElementsCached = null; // then add the parents, or the band's parent will be unregistered .. registerAsChild( element ); notifyNodeChildRemoved( o ); notifyNodeChildAdded( element ); }