RAP Display background-image CSS attributes [message #1772077] |
Tue, 05 September 2017 10:18  |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.06901 seconds