public void addTaggedComponent ( final String tag , final WComponent component ) { if ( Util . empty ( tag ) ) { throw new IllegalArgumentException ( "A tag must be provided." ) ; } if ( component == null ) { throw new IllegalArgumentException ( "A component must be provided." ) ; } TemplateModel model = getOrCreateComponentModel ( ) ; if ( model . taggedComponents == null ) { model . taggedComponents = new HashMap <> ( ) ; } else { if ( model . taggedComponents . containsKey ( tag ) ) { throw new IllegalArgumentException ( "The tag [" + tag + "] has already been added." ) ; } if ( model . taggedComponents . containsValue ( component ) ) { throw new IllegalArgumentException ( "Component has already been added." ) ; } } model . taggedComponents . put ( tag , component ) ; add ( component ) ; }
Add a tagged component to be included in the template . The component will be rendered in place of the corresponding tag in the template .