RAP-2.1 How to display image on the loading page? [message #1067149] |
Sat, 06 July 2013 13:11 |
Erwin Hogeweg Messages: 37 Registered: July 2009 |
Member |
|
|
Hi,
What is the proper way to show an animated gif on the loading page? With the code below, the body shows up, but w/o image. I followed the same pattern as for the favicon but I am not sure that is correct. I searched in the documentation, but I could not find an answer.
This is part of the Configurator where I register the image and load the body.html.
// Register favicon.
application.addResource( "favicon", new ResourceLoader() {
@Override
public InputStream getResourceAsStream( String resourceName ) throws IOException {
return this.getClass().getClassLoader().getResourceAsStream( "icons/favicon.png" );
}
} );
// Register loading.gif.
application.addResource( "html/loading.gif", new ResourceLoader() {
@Override
public InputStream getResourceAsStream( String resourceName ) throws IOException {
return this.getClass().getClassLoader().getResourceAsStream( "html/loading.gif" );
}
} );
Map<String, String> properties = new HashMap<String, String>();
properties.put( WebClient.FAVICON, "favicon");
properties.put( WebClient.BODY_HTML, getBody());
...
private String getBody(){
return new FileReader().readFileToString("html/body.html");
}
And this is what the body.html looks like. I tried different values for the img src (./loading.gif, ./html/loading, etc).
<div id="splash" style="position: absolute; margin-left: -75px; margin-top: -50px; left: 50%; top: 50%; width: 150px; border: 1px solid #c0c0c0; background-color: #fafafa; text-align: center;">
<img src="html/loading.gif" width="32" height="32" style="margin: 10px 15px 0" />
<div style="margin: 5px 15px 10px; color: #656565; font: 12px Verdana, 'Lucida Sans', sans-serif">
Loading ...
</div>
</div>
Any help is highly appreciated.
Kind Regards,
Erwin
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03905 seconds