use of net.sourceforge.nattable.painter.cell.ICellPainter in project translationstudio8 by heartsome.
the class MaxCellBoundsHelper method getPreferredColumnWidth.
/**
* Calculates the minimum width (in pixels) required to display the complete
* contents of the cells in a column. Takes into account the font settings
* and display type conversion.
*/
public static int getPreferredColumnWidth(ILayer layer, int columnPosition, IConfigRegistry configRegistry, GC gc) {
ICellPainter painter;
int maxWidth = 0;
LayerCell cell;
for (int rowPosition = 0; rowPosition < layer.getRowCount(); rowPosition++) {
cell = layer.getCellByPosition(columnPosition, rowPosition);
if (cell != null) {
painter = configRegistry.getConfigAttribute(CellConfigAttributes.CELL_PAINTER, cell.getDisplayMode(), cell.getConfigLabels().getLabels());
if (painter != null) {
int preferedWidth = painter.getPreferredWidth(cell, gc, configRegistry);
maxWidth = (preferedWidth > maxWidth) ? preferedWidth : maxWidth;
}
}
}
return maxWidth;
}
use of net.sourceforge.nattable.painter.cell.ICellPainter in project translationstudio8 by heartsome.
the class CellLayerPainter method paintCell.
protected void paintCell(LayerCell cell, GC gc, IConfigRegistry configRegistry) {
ICellPainter cellPainter = configRegistry.getConfigAttribute(CellConfigAttributes.CELL_PAINTER, cell.getDisplayMode(), cell.getConfigLabels().getLabels());
Rectangle adjustedCellBounds = adjustCellBounds(cell.getBounds());
cellPainter.paintCell(cell, gc, adjustedCellBounds, configRegistry);
}
use of net.sourceforge.nattable.painter.cell.ICellPainter in project translationstudio8 by heartsome.
the class MaxCellBoundsHelper method getPreferredRowHeight.
public static int getPreferredRowHeight(ILayer layer, int rowPosition, IConfigRegistry configRegistry, GC gc) {
int maxHeight = 0;
ICellPainter painter;
LayerCell cell;
for (int columnPosition = 0; columnPosition < layer.getColumnCount(); columnPosition++) {
cell = layer.getCellByPosition(columnPosition, rowPosition);
if (cell != null) {
painter = configRegistry.getConfigAttribute(CellConfigAttributes.CELL_PAINTER, cell.getDisplayMode(), cell.getConfigLabels().getLabels());
if (painter != null) {
int preferedHeight = painter.getPreferredHeight(cell, gc, configRegistry);
maxHeight = (preferedHeight > maxHeight) ? preferedHeight : maxHeight;
}
}
}
return maxHeight;
}
use of net.sourceforge.nattable.painter.cell.ICellPainter in project translationstudio8 by heartsome.
the class AutoResizeCurrentRowsCommandHandler method getPreferredRowHeight.
private int getPreferredRowHeight(ILayer layer, int rowPosition, IConfigRegistry configRegistry, GC gc, int clientAreaHeight) {
int maxHeight = 0;
ICellPainter painter;
LayerCell cell;
for (int columnPosition = 0; columnPosition < layer.getColumnCount(); columnPosition++) {
cell = layer.getCellByPosition(columnPosition, rowPosition);
if (cell != null) {
painter = configRegistry.getConfigAttribute(CellConfigAttributes.CELL_PAINTER, cell.getDisplayMode(), cell.getConfigLabels().getLabels());
if (painter != null) {
int preferedHeight = painter.getPreferredHeight(cell, gc, configRegistry);
maxHeight = (preferedHeight > maxHeight) ? preferedHeight : maxHeight;
}
}
}
if (maxHeight > clientAreaHeight) {
return clientAreaHeight;
}
return maxHeight;
}
use of net.sourceforge.nattable.painter.cell.ICellPainter in project translationstudio8 by heartsome.
the class RowHeightCalculator method getPreferredRowHeight.
private int getPreferredRowHeight(int rowPosition, IConfigRegistry configRegistry, int clientAreaHeight) {
int maxHeight = 0;
ICellPainter painter;
LayerCell cell;
SelectionLayer layer = bodyLayer.getSelectionLayer();
for (int columnPosition = 0; columnPosition < layer.getColumnCount(); columnPosition++) {
cell = layer.getCellByPosition(columnPosition, rowPosition);
if (cell != null) {
painter = configRegistry.getConfigAttribute(CellConfigAttributes.CELL_PAINTER, cell.getDisplayMode(), bodyLayer.getConfigLabelsByPosition(columnPosition, rowPosition).getLabels());
if (painter != null) {
int preferedHeight = painter.getPreferredHeight(cell, null, configRegistry);
maxHeight = (preferedHeight > maxHeight) ? preferedHeight : maxHeight;
}
}
}
if (maxHeight > clientAreaHeight) {
return clientAreaHeight;
}
return maxHeight;
}
Aggregations