Hello everybody,

I need some help concerning the TextMetrics class. What I want to do is just to auto resize the width of a grid column when adding a new row. This is what I've done so far, but somehow the width is not the size as expected:

Code:
        grid.getView().addListener(Events.RowUpdated, new Listener<GridEvent<Instrument>>() {
            @Override
            public void handleEvent(GridEvent<Instrument> be) {
                Instrument instrument = store.getAt(be.getRowIndex());

                TextMetrics metrics = TextMetrics.get();

                Element bidElement = (Element) grid.getView().getCell(be.getRowIndex(), 5);
                metrics.bind(bidElement);
                Integer x1 = metrics.getWidth(String.valueOf(instrument.getBid()));
                
                Element askElement = (Element) grid.getView().getCell(be.getRowIndex(), 6);
                metrics.bind(askElement);
                Integer x2 = metrics.getWidth(String.valueOf(instrument.getAsk()));
                
                Element timeElement = (Element) grid.getView().getCell(be.getRowIndex(), 7);
                metrics.bind(timeElement);
                Integer x3 = metrics.getWidth(instrument.getTime().toString());
                
                System.out.println(x1 + ", " + x2 + ", " + x3);
                
                grid.getColumnModel().getColumnById("bid").setWidth(x1);
                grid.getColumnModel().getColumnById("ask").setWidth(x2);
                grid.getColumnModel().getColumnById("time").setWidth(x3);
                grid.getView().refresh(true);
            }
        });