Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » RAP Display background-image CSS attributes(None-repeating and positioned Display background-image)
RAP Display background-image CSS attributes [message #1772077] Tue, 05 September 2017 10:18 Go to next message
Eclipse UserFriend
Are there plans to support CSS tags background-repeat and background-position for RAP objects?
In particular I would like this on the Display so that I can provide a customised image while the application is starting up (by default the gradient grey background image).
Ideally to support non-repeating in both directions and centred image e.g. "loading application... please wait..." image in the centre of a corporately-colours image.

background-repeat: no-repeat;
background-position: middle;

I'm not sure if there is a valid 'middle' value in CSS for position, but surely there is a way to achieve this?

Thanks, John
Re: RAP Display background-image CSS attributes [message #1772130 is a reply to message #1772077] Tue, 05 September 2017 20:56 Go to previous messageGo to next message
Eclipse UserFriend
I use the org.eclipse.rap.ui.branding extension point to supply a body html fragment
<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="./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">
    application loading ...
  </div>
</div>

loading.gif is in the same dir as the body.html fragment.

I never bothered to change the background gradient. That should be controlled by the theme.
Re: RAP Display background-image CSS attributes [message #1772172 is a reply to message #1772130] Wed, 06 September 2017 10:15 Go to previous message
Eclipse UserFriend
Thank-you Chris - that is a better way to do it.

In my application's Configuration#configure method I register any images I need:

...
application.addResource( "splash/loading.png", new ResourceLoader() {
@Override
public InputStream getResourceAsStream( String resourceName ) throws IOException {
return this.getClass().getClassLoader().getResourceAsStream( "splash/loading.png" );
}
} );

...then set the body html:

epProps.put( WebClient.BODY_HTML, "<div id='splash' style='text-align: center;'><br><br><img src='rwt-resources/splash/loading.png'/></div>" );

A hard-coded HTML string like this works OK, but a static html file would be nicer. I couldn't get that to work though.

I've hard-coded the image references with rwt-resources on the front, as I'm unable to call RWT.getResourceManager().getLocation in this method due to invalid thread access, but it is consistent, so that's OK for me.

Thanks, John
Previous Topic:Session timeout in RAP seems not working
Next Topic:Unable to Install RAP Target
Goto Forum:
  


Current Time: Wed Feb 12 00:12:10 GMT 2025

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

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

Back to the top