SplashScreen

My program takes a few seconds to start up. I want to create a splashScreen to indicate that the program is starting up , then disappear when the program starts like the way that Flex do it ?

Greetings Amine,

The way i do it is to make a new class ApplicationServlet extention class and replace the default Servlet with the new one in the web.xml.
You can then write what you want using page.write. Aldo there are limitations i bet. i just use it myself for managing the no script page mostly.

example of a overwritten servlet class :


package com.example.main;

import com.vaadin.terminal.gwt.server.ApplicationServlet;
import java.io.BufferedWriter;import java.io.IOException;

import javax.servlet.http.HttpServletRequest;


@SuppressWarnings("serial")
public class MyAppServet extends ApplicationServlet 
{    
	@Override    
	protected void writeAjaxPageHtmlMainDiv(BufferedWriter page, String appId, String classNames, String divStyle,HttpServletRequest obj)
	throws IOException 
	{       
		page.write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">");
		page.write("<div id=\"" + appId + "\" class=\"" + classNames + "\" "                + (divStyle != null ? divStyle : "") + ">");
		page.write("<div id='splashscreen'>Welcome<br/>"                        + 
				"page is loading hold on...</div>");
		page.write("</div>\n");
		page.write("</div>\n");  
		page.write("<noscript><META HTTP-EQUIV=\"refresh\" content=\"0;URL=http://www.websitewithoutjava.com/\"></noscript>");

		
	}
	
	@Override   	
	protected String getNoScriptMessage()
	{
		return "";//<META HTTP-EQUIV=\"refresh\" content=\"0;URL=http://www.websitewithoutjava.com/\">";
	}
	
}

change the “com.vaadin.terminal.gwt.server.ApplicationServlet” to the new servlet class in the web.xml:


		<servlet-name>My Application</servlet-name>
		<servlet-class>com.example.main.MyAppServet</servlet-class>

HI Arnold ,

Thanks for the reply , i tried it the application starts normally but don’t show nothing

Perhaps your page loads to fast? your code should be visible if you look at the sourcecode of your webpage.
It should be somewhere at the bottom. If you can not find anything there you need to check the web.xml.

i just added for a quicktest myself the following:

page.write(“

Welcome
<img src="http://www.spyderweb.nl/images/logo.jpg\” alt="spYderweb logo" height="91" width="640">"+ “text blablabla.
De Pagina wordt geladen…
”);

and i get the image just fine. (only for half a second or so before the page is loaded)

Yes it load fast , but it’s not really waht i looking for because i want at the same time that tha page is loaded i load data too