use of org.eclipse.nebula.widgets.nattable.resize.command.RowResizeCommand in project nebula.widgets.nattable by eclipse.
the class VerticalTextPainter method setNewMinLength.
@Override
protected void setNewMinLength(ILayerCell cell, int contentHeight) {
int cellLength = cell.getBounds().height;
if (cellLength < contentHeight) {
ILayer layer = cell.getLayer();
layer.doCommand(new RowResizeCommand(layer, cell.getRowPosition(), contentHeight, true));
}
}
use of org.eclipse.nebula.widgets.nattable.resize.command.RowResizeCommand in project nebula.widgets.nattable by eclipse.
the class RichTextCellPainter method paintCell.
@Override
public void paintCell(ILayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) {
IStyle cellStyle = CellStyleUtil.getCellStyle(cell, configRegistry);
setupGCFromConfig(gc, cellStyle);
String htmlText = CellDisplayConversionUtils.convertDataType(cell, configRegistry);
Rectangle painterBounds = new Rectangle(bounds.x, bounds.y - this.richTextPainter.getParagraphSpace(), bounds.width, bounds.height);
this.richTextPainter.paintHTML(htmlText, gc, painterBounds);
int height = this.richTextPainter.getPreferredSize().y - 2 * this.richTextPainter.getParagraphSpace();
if (performRowResize(height, painterBounds)) {
cell.getLayer().doCommand(new RowResizeCommand(cell.getLayer(), cell.getRowPosition(), GUIHelper.convertVerticalDpiToPixel(height) + (cell.getBounds().height - bounds.height)));
}
if (performColumnResize(this.richTextPainter.getPreferredSize().x, painterBounds)) {
cell.getLayer().doCommand(new ColumnResizeCommand(cell.getLayer(), cell.getColumnPosition(), GUIHelper.convertHorizontalDpiToPixel(this.richTextPainter.getPreferredSize().x) + (cell.getBounds().width - bounds.width)));
}
}
use of org.eclipse.nebula.widgets.nattable.resize.command.RowResizeCommand in project nebula.widgets.nattable by eclipse.
the class SummaryRowIntegrationTest method getRowHeightByPositionForSummaryRow.
@Test
public void getRowHeightByPositionForSummaryRow() throws Exception {
this.natTable.doCommand(new RowResizeCommand(this.natTable, 4, 100));
assertEquals(100, this.natTable.getRowHeightByPosition(4));
}
use of org.eclipse.nebula.widgets.nattable.resize.command.RowResizeCommand in project nebula.widgets.nattable by eclipse.
the class TableCellPainter method paintCell.
@Override
public void paintCell(ILayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) {
if (this.paintBg) {
super.paintCell(cell, gc, bounds, configRegistry);
}
Object[] cellDataArray = getDataAsArray(cell);
if (cellDataArray != null) {
// iterate over all values in the collection and render them
// separately by creating temporary sub cells
// and adding grid lines for the sub cells
int subGridY = bounds.y;
if (cellDataArray != null) {
Color originalColor = gc.getForeground();
for (int i = 0; i < cellDataArray.length; i++) {
ILayerCell subCell = createSubLayerCell(cell, cellDataArray[i]);
int subCellHeight = getSubCellHeight(subCell, gc, configRegistry);
Rectangle subCellBounds = new Rectangle(bounds.x, subGridY, bounds.width, subCellHeight);
this.getInternalPainter().paintCell(subCell, gc, subCellBounds, configRegistry);
// render sub grid line
// update subGridY for calculated height
subGridY += subCellHeight + 1;
gc.setForeground(cell.getDisplayMode().equals(DisplayMode.SELECT) ? getSelectedGridColor() : getGridColor());
gc.drawLine(bounds.x, subGridY, bounds.x + bounds.width, subGridY);
gc.setForeground(originalColor);
// increase subGridY by 1 so the next sub cell renders below
subGridY += 1;
}
// perform resize if necessary
int neededHeight = subGridY - bounds.y;
if (isCalculateParentCellHeight() && (neededHeight > cell.getBounds().height)) {
ILayer layer = cell.getLayer();
layer.doCommand(new RowResizeCommand(layer, cell.getRowPosition(), neededHeight, true));
}
}
} else {
this.getInternalPainter().paintCell(cell, gc, bounds, configRegistry);
}
}
use of org.eclipse.nebula.widgets.nattable.resize.command.RowResizeCommand in project nebula.widgets.nattable by eclipse.
the class VerticalTextImagePainter method setNewMinLength.
@Override
protected void setNewMinLength(ILayerCell cell, int contentHeight) {
int cellLength = cell.getBounds().height;
if (cellLength < contentHeight) {
ILayer layer = cell.getLayer();
layer.doCommand(new RowResizeCommand(layer, cell.getRowPosition(), contentHeight, true));
}
}
Aggregations