[ovirt-devel] [ACTION REQUESTED] new tooltips! don't use title='tooltip' anymore

Vojtech Szocs vszocs at redhat.com
Sun Mar 22 08:04:35 UTC 2015



----- Original Message -----
> From: "Greg Sheremeta" <gshereme at redhat.com>
> To: devel at ovirt.org
> Sent: Friday, 20 March, 2015 10:37:04 PM
> Subject: [ovirt-devel] [ACTION REQUESTED] new tooltips! don't use	title='tooltip' anymore
> 
> Hi,
> 
> TL;DR: there are new tooltip classes. Please only use the new stuff
> going forward.
> 
> ...
> 
> A bunch of patches were merged this week that converted every tooltip
> in ovirt-engine to use PatternFly (Bootstrap3) tooltips. Examples: [1]

Nice work, Greg!

The column/cell infra cleanup is much appreciated.

> 
> Since we want to keep all of the tooltips looking the same, please
> don't use DecoratedPanels or title attributes for tooltips anymore.
> Going forward, you must use the WidgetTooltip class (if you're putting
> a tooltip on a Widget), or the built in getTooltip() template method
> if you're providing a tooltip in a grid. [2]
> 
> As part of this effort, I did some cleanup / refactoring to the Cell
> and Column infrastructure.
> 
> A few noteworthy things:
> 
> * All custom Cells that simply provided some variation of tooltip
>   behavior were removed. Tooltips are now provided for free by the
>   root objects in the Cell and Column hierarchy.
> 
> * Almost all Columns use the template-method pattern for rendering
>   a tooltip. Simply override the getTooltip method with tooltip
>   contents. 'null' is ok (means no tooltip).
> 
> * Cells also use the same template-method pattern for supporting a
>   tooltip render, but tooltips should render in Columns wherever
>   possible. Only use direct Cell rendering if absolutely necessary --
>   for example, in CompositeCells.
> 
> * Text truncation behavior now lives in TextCell. There are two
>   truncation methods -- fixed length limit, or CSS overflow-based.
>   Text that is truncated will show in a tooltip, unless a manual
>   tooltip is provided on that Column. (In other words, if text is
>   too long to fit in a column, '...' will appear and a tooltip will
>   show the full contents. Unless you override that behavior by
>   setting your own tooltip in getTooltip().)
> 
> * The Element ID Framework is fully integrated now. All Cell render
>   methods are passed a unique ID. Please use it in your render. This
>   helps with automated tests.
> 
> 
> Some code examples:
> 
> in UIBinder:
> 
> <t:WidgetTooltip ui:field="tooltip">
>     <g:SomeWidget ...>
> </t:WidgetTooltip>
> 
> ...
> 
> @UiField
> WidgetTooltip tooltip;
> 
> ...
> 
> tooltip.setHtml(someToolipValue);
> tooltip.reconfigure();
> 
> 
> 
> in a Column:
> 
> @Override
> public SafeHtml getTooltip(XXXX object) {
>     String tooltipContent = object.someProperty();
>     return SafeHtmlUtils.fromString(tooltipContent);
> }
> 
> or, if a constant tooltip:
> 
> @Override
> public SafeHtml getTooltip(XXXX object) {
>     return SafeHtmlUtils.fromTrustedConstant(constants.someConstant());
> }
> 
> 
> Let me know if there are any questions, or if you see any bugs!
> 
> Thanks,
> Greg
> 
> [1] http://i.imgur.com/rZ5oIIb.png
>     http://i.imgur.com/6lpKuSD.png
>     http://i.imgur.com/hYcZSuT.png
>     http://i.imgur.com/9oKZnK4.png
> 
> [2] you can also put a tooltip on an Element, but try to use a
>     Widget if you can. See TooltipMixin::addTooltipToElement()
> 
> 
> Greg Sheremeta
> Red Hat, Inc.
> Sr. Software Engineer, RHEV
> Cell: 919-807-1086
> gshereme at redhat.com
> _______________________________________________
> Devel mailing list
> Devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/devel
> 



More information about the Devel mailing list