@ Override public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { WApplication application = ( WApplication ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; UIContext uic = UIContextHolder . getCurrent ( ) ; String focusId = uic . getFocussedId ( ) ; // Check that this is the top level component if ( application . getParent ( ) != null ) { LOG . warn ( "WApplication component should be the top level component." ) ; } xml . appendTagOpen ( "ui:application" ) ; xml . appendAttribute ( "id" , component . getId ( ) ) ; xml . appendOptionalAttribute ( "class" , component . getHtmlClass ( ) ) ; xml . appendUrlAttribute ( "applicationUrl" , uic . getEnvironment ( ) . getPostPath ( ) ) ; xml . appendUrlAttribute ( "ajaxUrl" , uic . getEnvironment ( ) . getWServletPath ( ) ) ; xml . appendOptionalAttribute ( "unsavedChanges" , application . hasUnsavedChanges ( ) , "true" ) ; xml . appendOptionalAttribute ( "title" , application . getTitle ( ) ) ; xml . appendOptionalAttribute ( "defaultFocusId" , uic . isFocusRequired ( ) && ! Util . empty ( focusId ) , focusId ) ; xml . appendOptionalUrlAttribute ( "icon" , WApplication . getIcon ( ) ) ; xml . appendClose ( ) ; // Tracking enabled globally if ( TrackingUtil . isTrackingEnabled ( ) ) { xml . appendTagOpen ( "ui:analytic" ) ; xml . appendAttribute ( "clientId" , TrackingUtil . getClientId ( ) ) ; xml . appendOptionalAttribute ( "cd" , TrackingUtil . getCookieDomain ( ) ) ; xml . appendOptionalAttribute ( "dcd" , TrackingUtil . getDataCollectionDomain ( ) ) ; xml . appendOptionalAttribute ( "name" , TrackingUtil . getApplicationName ( ) ) ; xml . appendEnd ( ) ; } // Hidden fields Map < String , String > hiddenFields = uic . getEnvironment ( ) . getHiddenParameters ( ) ; if ( hiddenFields != null ) { for ( Map . Entry < String , String > entry : hiddenFields . entrySet ( ) ) { xml . appendTagOpen ( "ui:param" ) ; xml . appendAttribute ( "name" , entry . getKey ( ) ) ; xml . appendAttribute ( "value" , entry . getValue ( ) ) ; xml . appendEnd ( ) ; } } // Custom CSS Resources (if any) for ( WApplication . ApplicationResource resource : application . getCssResources ( ) ) { String url = resource . getTargetUrl ( ) ; if ( ! Util . empty ( url ) ) { xml . appendTagOpen ( "ui:css" ) ; xml . appendUrlAttribute ( "url" , url ) ; xml . appendEnd ( ) ; } } // Custom JavaScript Resources (if any) for ( WApplication . ApplicationResource resource : application . getJsResources ( ) ) { String url = resource . getTargetUrl ( ) ; if ( ! Util . empty ( url ) ) { xml . appendTagOpen ( "ui:js" ) ; xml . appendUrlAttribute ( "url" , url ) ; xml . appendEnd ( ) ; } } paintChildren ( application , renderContext ) ; xml . appendEndTag ( "ui:application" ) ; }
Paints the given WApplication .