Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » RAP-2.1 How to display image on the loading page?(How to display an image in the WebClient.BODY_HTML?)
RAP-2.1 How to display image on the loading page? [message #1067149] Sat, 06 July 2013 13:11 Go to next message
Erwin Hogeweg is currently offline Erwin HogewegFriend
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
Re: RAP-2.1 How to display image on the loading page? [message #1067158 is a reply to message #1067149] Sat, 06 July 2013 20:06 Go to previous messageGo to next message
Erwin Hogeweg is currently offline Erwin HogewegFriend
Messages: 37
Registered: July 2009
Member
The image is loaded as a resource so the image src location is "rwt-resources/loading.gif".

Changed the body as follows and it works like a charm now:
<div id="splash" style="position: absolute; margin-left: -200px; margin-top: -50px; left: 50%; top: 50%; width: 400px; border: 1px solid #c0c0c0; background-color: #fafafa; text-align: center;">
  <img src="rwt-resources/loading.gif" width="32" height="32" style="margin: 10px 15px 0" />
  <div style="margin: 5px 15px 10px; color: #656565; font: 18px Verdana, 'Lucida Sans', sans-serif">
    Loading ...
  </div>
</div>


Cheers,

Erwin
Re: RAP-2.1 How to display image on the loading page? [message #1067524 is a reply to message #1067158] Tue, 09 July 2013 08:31 Go to previous message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi Erwin,

good that you found it. I agree it's not obvious. We have it on our plan
to think about improvements for registering static resources.

Regards,
Ralf

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Previous Topic:Tycho build with RAP 2.1
Next Topic:RAP 2.1 + Virgo 3.6.2: illegalState Exception
Goto Forum:
  


Current Time: Fri Apr 26 11:45:22 GMT 2024

Powered by FUDForum. Page generated in 0.03118 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top