rowmouseovereclipse-scout

Eclipse Scout Neon table cell mouseover


I would like to know how to achieve mouseover on a cell, if a column is too short for full text.

So, if I have column with fix width, and text is too long, how to present whole text with mouseover in a cell.


Solution

  • You can dynamically add a mouse over tooltip on any cell by overriding the

    execDecorateCell(Cell view, ITableRow row, IColumn<?> col) method in AbstractTable and setting your tooltip text like

    @Override
    protected void execDecorateCell(Cell view, ITableRow row, IColumn<?> col) {
        super.execDecorateCell(view, row, col);
        view.setTooltipText("Hi there: " + view.getText());
    }
    

    Unfortunately, this does not consider if your text length exceeds the length of your column/cell. It will set the tooltip text in any case! So far, I am not sure, whether (or how) it is possible to calculate (in pixels?), if the actual string length inside a cell exceeds ones column length. Maybe you could try something, that takes the actual string length into account (java.lang.String.length()) and only provide a tooltip if a certain length is given.

    Let me know, if this is works for you!

    Best regards,
    Matthias