Bug in VerticalTextPainter.paintCell() [message #1018948] |
Thu, 14 March 2013 18:51 |
Rashmy A Messages: 149 Registered: July 2009 |
Senior Member |
|
|
Hello,
There seems to be a bug in resizing the column width within VerticalTextPainter.paintCell()
//if the width is bigger than the available column width
//we're extending the column width (only if word wrapping is enabled)
int fontHeight = gc.getFontMetrics().getHeight();
int contentWidth = fontHeight * numberOfNewLines;
int contentToCellDiff = (cell.getBounds().width - rectangle.width);
if ((contentWidth > rectangle.width) && calculate)
{
...
new ColumnResizeCommand(..)
}
if (text != null && text.length() > 0)
{
if (numberOfNewLines == 1) {
int contentHeight = Math.min(getLengthFromCache(gc, text), rectangle.height);
GraphicsUtils.drawVerticalText(
text,
rectangle.x + CellStyleUtil.getHorizontalAlignmentPadding(cellStyle, rectangle,
contentWidth) + spacing,
rectangle.y + CellStyleUtil.getVerticalAlignmentPadding(cellStyle, rectangle,
contentHeight + spacing),
gc,
SWT.UP);
To see if the column needs to be re-sized, we are checking:
"contentWidth > rectangle.width"
We should also consider the horizontalAlignmentPadding and spacing. This is because while actually drawing the text, the x position is changed using both of these.
Also, it would be good to skip use "calculate" flag when testing for column re-size.
Regards,
Rashmy
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04027 seconds