Skip to main content



      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 15:53 Go to next message
Eclipse UserFriend
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 18:04] by Moderator

Re: Grid, Template and selected row image [message #1785221 is a reply to message #1785204] Wed, 11 April 2018 03:17 Go to previous messageGo to next message
Eclipse UserFriend
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 07:37 Go to previous messageGo to next message
Eclipse UserFriend
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 17:38 Go to previous messageGo to next message
Eclipse UserFriend
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 04:12 Go to previous messageGo to next message
Eclipse UserFriend
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 02:50 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 17:04:06 EDT 2025

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

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

Back to the top