Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 364969 - [Tree][Table] Provide a distinct sub-widget to style hovered items
Summary: [Tree][Table] Provide a distinct sub-widget to style hovered items
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P2 enhancement (vote)
Target Milestone: 1.5 M7   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard: plan-version=1.5 plan-theme=widgets p...
Keywords:
: 372362 (view as bug list)
Depends on:
Blocks: 330004
  Show dependency tree
 
Reported: 2011-11-28 10:44 EST by Rüdiger Herrmann CLA
Modified: 2012-04-27 08:38 EDT (History)
2 users (show)

See Also:


Attachments
patch for overlay implementation (39.47 KB, patch)
2012-03-27 11:08 EDT, Tim Buschtoens CLA
no flags Details | Diff
updated patch (58.14 KB, patch)
2012-03-28 08:10 EDT, Tim Buschtoens CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rüdiger Herrmann CLA 2011-11-28 10:44:45 EST
In order to style items of a Tree/Table that are hovered there is a :hover style on the TreeItem/TableItem CSS rule.

With the other states of the TreeItem/TableItem (like :linesvisible :even) it is complex to create and maintain style rules that match every combination of states. Clients that just want to tweak the hover styling are also confronted with this complexity.
Moreover it is currently not possible to style an item so that there apprears no extra styling when hovered.

I suggest to introduce sub-widgets TableItem-Overlay and TreeItem-Overlay (or similarly named) that hold all styles that are to be applied when an item is hovered over.
Comment 1 Ralf Sternberg CLA 2011-11-29 08:15:59 EST
I agree to this proposal since the current situation is not intuitive. Instead of setting the hover effect itself to transparent, one would currently set the hovered row to transparent, effectively overwriting any themed row colors.
Comment 2 Ralf Sternberg CLA 2012-02-23 12:27:23 EST
*** Bug 372362 has been marked as a duplicate of this bug. ***
Comment 3 Tim Buschtoens CLA 2012-03-27 11:08:58 EDT
Created attachment 213237 [details]
patch for overlay implementation

This patch contains the full implementation of this feature. The subwidget is called Table-RowOverlay, but i'm actually not in favor of that name. (See next post).
Comment 4 Tim Buschtoens CLA 2012-03-27 11:45:20 EDT
A preliminary note: When i talk about selection or hover, this includes the other aswell, as the technical issues are identical for both. Same goes for Table and Tree.

First, let me sum up how the behavior is right now: 

1) Theming knows the Widget "TableItem". In the default und buisness theme, rules for all combinations of hover, selected, linesvisible, even and unfocused.

2) If you use a theme-contribution, you have to overwrite them all to change the hover/selection colors.

3) If you define a custom theme based on the fallback-theming (xxx.default.css), that is not the case, there only hover and selected are defined (separately).

4) Usually in RAP programatically set colors overwrite theming colors. Thats also the case for Table, UNLESS selection or hover state are set. In that case the widget is hardcoded to ignore programatically set colors of the item. This means, even if all possible combinations of states are setting the background to transparent, the item-colors are still disappearing on hover/selection, even if the theming colors don't change.

What the patch does: It introduces a new theming-widget called "Table-RowOverlay". It has all the states of TableItem, and most of its properties. If a property is defined on this widget (i.e. its not transparent, inherit or none - which can also be influenced by "*"), it is used in any case, overwriting the items theming and programatic color. The priority now looks like this (from high to low):

* Value from "Table-RowOverlay" theming-widget.
* Value from SWT-widget.
* Value from "TableItem" theming-widget.

Whether the programatically set colors are overwritting or not is no longer hardcoded, but depending on whether the overlay has colors defined for the currently states. Therefore, the theming completely controls which colors are used.

This does actually not change anything about points 2 and 3, but i think this bug was opend before the fallback-theming existed. Note that the overlay widget gets ALL states from item, including the custom-variant. For one thing, this is a result of the technical implementation, but its also necessary for compatibility as it is/was possible (and used in our themes) to have different hover/selection effects depending on states like unfocused.

The default theme in this patch has been adjusted to behave the way it was before. (I.e. all hover and selection states are theming using the overlay.)

I'm not happy with the name "Table-RowOverlay", i think its confusing. I prefere "TableItem-Overlay": The overlay is rendered completely within the bounds of the item, there is one per item (think of selection), and a "row" is nothing the application developer knows, it's an implementation detail we have only because of virtual scrolling.
Comment 5 Tim Buschtoens CLA 2012-03-27 11:46:19 EDT
Note to self: I forgot to add theming-tests for the new subwidget, and i also didn't adapt the business/fancy theme.
Comment 6 Tim Buschtoens CLA 2012-03-28 08:10:52 EDT
Created attachment 213286 [details]
updated patch

Updated patch:
- fixed a problem with unfocused theming of overlay
- fixed buisness and fancy theme
- updated theming tests
Comment 7 Tim Buschtoens CLA 2012-04-27 08:38:49 EDT
Comitted patch to CVS HEAD with minor changes.