Search in sources :

Example 6 with ICellRenderer

use of de.jaret.util.ui.table.renderer.ICellRenderer in project translationstudio8 by heartsome.

the class JaretTable method registerDefaultRenderers.

/**
     * Register all default renderers.
     * 
     */
private void registerDefaultRenderers() {
    ICellRenderer cellRenderer = new TextCellRenderer();
    registerCellRenderer(void.class, cellRenderer);
    registerCellRenderer(String.class, cellRenderer);
    registerCellRenderer(Image.class, new ImageCellRenderer());
    cellRenderer = new BooleanCellRenderer();
    registerCellRenderer(Boolean.class, cellRenderer);
    registerCellRenderer(Boolean.TYPE, cellRenderer);
    cellRenderer = new DateCellRenderer();
    registerCellRenderer(Date.class, cellRenderer);
    registerCellRenderer(JaretDate.class, cellRenderer);
    cellRenderer = new DoubleCellRenderer();
    registerCellRenderer(Double.class, cellRenderer);
    registerCellRenderer(Double.TYPE, cellRenderer);
}
Also used : TextCellRenderer(de.jaret.util.ui.table.renderer.TextCellRenderer) DateCellRenderer(de.jaret.util.ui.table.renderer.DateCellRenderer) DoubleCellRenderer(de.jaret.util.ui.table.renderer.DoubleCellRenderer) ICellRenderer(de.jaret.util.ui.table.renderer.ICellRenderer) BooleanCellRenderer(de.jaret.util.ui.table.renderer.BooleanCellRenderer) ImageCellRenderer(de.jaret.util.ui.table.renderer.ImageCellRenderer)

Example 7 with ICellRenderer

use of de.jaret.util.ui.table.renderer.ICellRenderer in project translationstudio8 by heartsome.

the class JaretTable method drawCell.

/**
     * Draw a single cell. Drawing is accomplished by the associated cell renderer. However the mark for fill dragging
     * is drawn by this method.
     * 
     * @param gc gc
     * @param area drawing area the cell takes up
     * @param row row of the cell
     * @param col olumn of the cell
     */
private void drawCell(GC gc, Rectangle area, IRow row, IColumn col) {
    ICellStyle bc = _tvs.getCellStyle(row, col);
    ICellRenderer cellRenderer = getCellRenderer(row, col);
    boolean hasFocus = false;
    if (_focussedRow == row && _focussedColumn == col) {
        // == is appropriate: these are really the same objects!
        hasFocus = true;
    }
    boolean isSelected = isSelected(row, col);
    cellRenderer.draw(gc, this, bc, area, row, col, hasFocus, isSelected, false);
    if (_supportFillDragging && isSelected && isDragMarkerCell(row, col)) {
        drawFillDragMark(gc, area);
    }
}
Also used : ICellStyle(de.jaret.util.ui.table.renderer.ICellStyle) ICellRenderer(de.jaret.util.ui.table.renderer.ICellRenderer)

Aggregations

ICellRenderer (de.jaret.util.ui.table.renderer.ICellRenderer)7 ICellStyle (de.jaret.util.ui.table.renderer.ICellStyle)3 IColumn (de.jaret.util.ui.table.model.IColumn)1 IJaretTableCell (de.jaret.util.ui.table.model.IJaretTableCell)1 BooleanCellRenderer (de.jaret.util.ui.table.renderer.BooleanCellRenderer)1 DateCellRenderer (de.jaret.util.ui.table.renderer.DateCellRenderer)1 DoubleCellRenderer (de.jaret.util.ui.table.renderer.DoubleCellRenderer)1 ImageCellRenderer (de.jaret.util.ui.table.renderer.ImageCellRenderer)1 TextCellRenderer (de.jaret.util.ui.table.renderer.TextCellRenderer)1 Point (org.eclipse.swt.graphics.Point)1 Rectangle (org.eclipse.swt.graphics.Rectangle)1