void add ( final WComponent component ) { assertAddSupported ( component ) ; assertNotReparenting ( component ) ; if ( ! ( this instanceof Container ) ) { throw new UnsupportedOperationException ( "Components can only be added to a container" ) ; } ComponentModel model = getOrCreateComponentModel ( ) ; if ( model . getChildren ( ) == null ) { model . setChildren ( new ArrayList < WComponent > ( 1 ) ) ; } model . getChildren ( ) . add ( component ) ; if ( isLocked ( ) ) { component . setLocked ( true ) ; } if ( component instanceof AbstractWComponent ) { ( ( AbstractWComponent ) component ) . getOrCreateComponentModel ( ) . setParent ( ( Container ) this ) ; ( ( AbstractWComponent ) component ) . addNotify ( ) ; } }
Adds the given component as a child of this component .