Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Grid, Template and selected row image
Grid, Template and selected row image [message #1785204] Tue, 10 April 2018 19:53 Go to next message
Frank.K Mising name is currently offline Frank.K Mising nameFriend
Messages: 15
Registered: January 2013
Junior Member
In our application we are using a Grid with a Template that consists out of several TextCells and one ImageCell.
Everything works pretty well so far, but we couldn't find a way to exchange the image in selected state.
Reason why we like to change the image is that it is very dark, which works good on brighter backgrounds, but is barely visible, when a row was selected.

We already have the images in a white and a black version, but anything similar e.g. simply inverting it would do the trick, too.

[Updated on: Tue, 10 April 2018 22:04]

Report message to a moderator

Re: Grid, Template and selected row image [message #1785221 is a reply to message #1785204] Wed, 11 April 2018 07:17 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi,
we have an example to show/hide image when row is hovered with pure CSS implementation in our Examples Demo [1]. Your use case is more complex and I can't think about a solution right now. Maybe something with client scripting?!

[1] http://rap.eclipsesource.com/demo/release/rapdemo/#table-template
[2] https://github.com/eclipse/rap/blob/master/examples/org.eclipse.rap.examples/src/resources/head.html
Regards,
Ivan
Re: Grid, Template and selected row image [message #1785240 is a reply to message #1785221] Wed, 11 April 2018 11:37 Go to previous messageGo to next message
Frank.K Mising name is currently offline Frank.K Mising nameFriend
Messages: 15
Registered: January 2013
Junior Member
Thanks Ivan,

I'm trying to use client scripting, but I'm already stuck at the beginning. Seems my simple ClientListener is never called, i.e. I don't see any log output in the browser console.

Just for testing I've also added a simple selection listener. This way I can see the log output "test2" for each selection change, but no "test".

grid = new Grid(twoColum, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
viewer = new GridTableViewer(grid);

grid.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);
grid.setItemHeight(ROW_HEIGHT);

Template template = new Template();
[ template stuff ]
grid.setData(RWT.ROW_TEMPLATE, template);

grid.addListener(SWT.Selection, new Listener()
        {
            @Override
            public void handleEvent(final Event event)
            {
                JavaScriptExecutor executor = RWT.getClient().getService(JavaScriptExecutor.class);
                executor.execute("console.log(\"test2\");");
            }
        });

grid.addListener(SWT.Selection,
                new ClientListener("function handleEvent(event){console.log(\"test\"); };"));
Re: Grid, Template and selected row image [message #1785275 is a reply to message #1785240] Wed, 11 April 2018 21:38 Go to previous messageGo to next message
Chris Fairhall is currently offline Chris FairhallFriend
Messages: 221
Registered: February 2011
Senior Member
That could be because GridLCA never calls org.eclipse.rap.rwt.internal.lifecycle.WidgetLCAUtil.renderClientListeners(Widget)

At least it doesn't in RAP 3.5-M2 as far as I can tell.

Does Grid not support client listeners?
Re: Grid, Template and selected row image [message #1785520 is a reply to message #1785275] Mon, 16 April 2018 08:12 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Chris is absolutely right. Tree/Table and Nebula Grid do not support client listeners. As this is the most complicated JS widget in RWT, using client listeners is too risky and you can break basic functionality easily.
Regards,
Ivan
Re: Grid, Template and selected row image [message #1785577 is a reply to message #1785520] Tue, 17 April 2018 06:50 Go to previous message
Frank.K Mising name is currently offline Frank.K Mising nameFriend
Messages: 15
Registered: January 2013
Junior Member
Thanks for checking.

Anyways I found a way to switch the images using a simple SelectionListener, even though it is called after the selection has changed. So the downside is that you can see a minor time difference between the text and image changes.
Still good enough to continue with other stuff. ;)
Previous Topic:UI is blank after loosing connection for some time
Next Topic:iOS, Safari: open keyboard with setFocus() for Text
Goto Forum:
  


Current Time: Sat Apr 27 02:33:45 GMT 2024

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

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

Back to the top