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
John Gymer is currently offline John GymerFriend
Messages: 257
Registered: November 2012
Location: UK
Senior Member
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


---
Just because you can doesn't mean you should
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
Chris Fairhall is currently offline Chris FairhallFriend
Messages: 197
Registered: February 2011
Senior Member
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
John Gymer is currently offline John GymerFriend
Messages: 257
Registered: November 2012
Location: UK
Senior Member
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


---
Just because you can doesn't mean you should
Previous Topic:Session timeout in RAP seems not working
Next Topic:Unable to Install RAP Target
Goto Forum:
  


Current Time: Mon May 28 03:40:53 GMT 2018

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

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

Back to the top