gwtbootstrap / gwt-bootstrap

A GWT Library that provides the widgets of Bootstrap, from Twitter.
http://gwtbootstrap.github.com
406 stars 190 forks source link

TooltipCellDecorator for TextCells #515

Open phnmnm opened 9 years ago

phnmnm commented 9 years ago

Hi,

I already posted this on a closed issue. Wasnt sure if you see it. Related to #238.

Im trying to add a TooltipCellDecorator to a TextCell. Is this only possible for ButtonCells?

    TextCell textCell = new TextCell();
    TooltipCellDecorator<String> cellDecorator = new TooltipCellDecorator<>(textCell);
    cellDecorator.setAnimation(true);
    cellDecorator.setHideDelay(1000);
    cellDecorator.setShowDelay(200);
    cellDecorator.setPlacement(Placement.BOTTOM);
    final ToolTipColumn<GwtSynchronizedPropertyDTO> tNameCol = new ToolTipColumn<GwtSynchronizedPropertyDTO>(textCell, cellDecorator) {
            @Override
            public String getValue(GwtSynchronizedPropertyDTO pItem) {
                return (pItem.getName() != null) ? pItem.getName() : "  -";
            }
        };
public abstract class ToolTipColumn<T> extends Column<T, String> {

    TooltipCellDecorator cellDecorator;

    public ToolTipColumn(TextCell pTextCell, TooltipCellDecorator pTooltipCellDecorator)
    {
        super(pTextCell);

        cellDecorator = pTooltipCellDecorator;
    }

    @Override
    public void onBrowserEvent(Cell.Context context, Element elem, T object, NativeEvent event) {
        super.onBrowserEvent(context, elem, object, event);
    }

    @Override
    public void render(Cell.Context context, T object, SafeHtmlBuilder sb) {
        cellDecorator.render(context, getValue(object), sb);
    }
}

I dont know if its the right spot to post this. But I would be happy if you could help me. Am I missing something?

I added the override to the onBrowserEvent. But it isnt called. It looks like it doesnt listen to the HOVER of the cell.

Best regards,

phnmnm commented 9 years ago

Any hints?

bxf12315 commented 9 years ago

Hi, i met same issue, could you have any solution ?