Package org.eclipse.nebula.widgets.nattable.painter.cell

Examples of org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter


        Image image = new Image(natTable.getDisplay(), cellBounds.width,
                cellBounds.height);

        GC gc = new GC(image);
        IConfigRegistry configRegistry = natTable.getConfigRegistry();
        ICellPainter cellPainter = cell.getLayer().getCellPainter(
                columnPosition, rowPosition, cell, configRegistry);
        if (cellPainter != null) {
            cellPainter.paintCell(cell, gc, new Rectangle(0, 0,
                    cellBounds.width, cellBounds.height), configRegistry);
        }
        gc.dispose();

        ImageData imageData = image.getImageData();
View Full Code Here


     * contents of the cells in a column. Takes into account the font settings
     * and display type conversion.
     */
    private static int getPreferredColumnWidth(ILayer layer,
            int columnPosition, IConfigRegistry configRegistry, GC gc) {
        ICellPainter painter;
        int maxWidth = 0;
        ILayerCell cell;

        for (int rowPosition = 0; rowPosition < layer.getRowCount(); rowPosition++) {
            cell = layer.getCellByPosition(columnPosition, rowPosition);
            if (cell != null) {
                boolean atEndOfCellSpan = cell.getOriginColumnPosition()
                        + cell.getColumnSpan() - 1 == columnPosition;
                if (atEndOfCellSpan) {
                    painter = layer.getCellPainter(cell.getColumnPosition(),
                            cell.getRowPosition(), cell, configRegistry);
                    if (painter != null) {
                        int preferredWidth = painter.getPreferredWidth(cell,
                                gc, configRegistry);

                        // Adjust width
                        Rectangle bounds = cell.getBounds();
                        bounds.width = preferredWidth;
View Full Code Here

    }

    private static int getPreferredRowHeight(ILayer layer, int rowPosition,
            IConfigRegistry configRegistry, GC gc) {
        int maxHeight = 0;
        ICellPainter painter;
        ILayerCell cell;

        for (int columnPosition = 0; columnPosition < layer.getColumnCount(); columnPosition++) {
            cell = layer.getCellByPosition(columnPosition, rowPosition);
            if (cell != null) {
                boolean atEndOfCellSpan = cell.getOriginRowPosition()
                        + cell.getRowSpan() - 1 == rowPosition;
                if (atEndOfCellSpan) {
                    painter = layer.getCellPainter(cell.getColumnPosition(),
                            cell.getRowPosition(), cell, configRegistry);
                    if (painter != null) {
                        int preferredHeight = painter.getPreferredHeight(cell,
                                gc, configRegistry);

                        // Adjust height
                        Rectangle bounds = cell.getBounds();
                        bounds.height = preferredHeight;
View Full Code Here

    }

    @Override
    public ICellPainter getCellPainter(int columnPosition, int rowPosition,
            ILayerCell cell, IConfigRegistry configRegistry) {
        ICellPainter cellPainter = super.getCellPainter(columnPosition,
                rowPosition, cell, configRegistry);

        if (cell.getConfigLabels().hasLabel(TREE_COLUMN_CELL)) {

            ICellPainter treeCellPainter = configRegistry.getConfigAttribute(
                    TreeConfigAttributes.TREE_STRUCTURE_PAINTER,
                    cell.getDisplayMode(), cell.getConfigLabels().getLabels());

            if (treeCellPainter != null) {
                ICellPainter innerWrapper = treeCellPainter;
                IndentedTreeImagePainter treePainter = null;
                if (innerWrapper instanceof IndentedTreeImagePainter) {
                    treePainter = (IndentedTreeImagePainter) innerWrapper;
                } else {
                    while (treePainter == null
View Full Code Here

                                .getResourceAsStream(
                                        "/org/eclipse/nebula/widgets/nattable/examples/resources/selected_column_header_bg.png"));

                TextPainter txtPainter = new TextPainter(false, false);

                ICellPainter bgImagePainter = new BackgroundImagePainter(
                        txtPainter, bgImage, GUIHelper.getColor(192, 192, 192));

                configRegistry.registerConfigAttribute(
                        CellConfigAttributes.CELL_PAINTER, bgImagePainter,
                        DisplayMode.NORMAL, GridRegion.COLUMN_HEADER);
                configRegistry.registerConfigAttribute(
                        CellConfigAttributes.CELL_PAINTER, bgImagePainter,
                        DisplayMode.NORMAL, GridRegion.CORNER);

                ICellPainter hoveredHeaderPainter = new BackgroundImagePainter(
                        txtPainter, hoverBgImage, GUIHelper.getColor(192, 192,
                                192));

                configRegistry.registerConfigAttribute(
                        CellConfigAttributes.CELL_PAINTER,
                        hoveredHeaderPainter, DisplayMode.HOVER,
                        GridRegion.COLUMN_HEADER);

                ICellPainter selectedHeaderPainter = new BackgroundImagePainter(
                        txtPainter, selectedBgImage, GUIHelper.getColor(192,
                                192, 192));

                configRegistry.registerConfigAttribute(
                        CellConfigAttributes.CELL_PAINTER,
View Full Code Here

    public IndentedTreeImagePainter(int treeIndent,
            ICellPainter interiorPainter, CellEdgeEnum cellEdge,
            boolean paintBg, int spacing, boolean paintDecorationDependent) {
        this.treeIndent = treeIndent;

        ICellPainter painter = new TreeImagePainter(paintBg);
        this.internalPainter = new CellPainterDecorator(interiorPainter,
                cellEdge, spacing, painter, paintDecorationDependent, paintBg);
        setWrappedPainter(this.internalPainter);
    }
View Full Code Here

    public IndentedTreeImagePainter(int treeIndent,
            ICellPainter interiorPainter, boolean paintBg,
            boolean interiorPainterToSpanFullWidth) {
        this.treeIndent = treeIndent;

        ICellPainter painter = new TreeImagePainter(paintBg);
        this.internalPainter = new CellPainterDecorator(interiorPainter,
                CellEdgeEnum.RIGHT, 0, painter,
                !interiorPainterToSpanFullWidth, paintBg);
        setWrappedPainter(this.internalPainter);
    }
View Full Code Here

        ILayerCell cell = natTable.getCellByPosition(col, row);
        if (cell != null) {
            // if the registered cell painter is the PasswordCellPainter, there
            // will be no tooltip
            ICellPainter painter = natTable.getConfigRegistry()
                    .getConfigAttribute(CellConfigAttributes.CELL_PAINTER,
                            DisplayMode.NORMAL,
                            cell.getConfigLabels().getLabels());
            if (isVisibleContentPainter(painter)) {
                String tooltipValue = CellDisplayConversionUtils
View Full Code Here

        configRegistry.registerConfigAttribute(
                FilterRowConfigAttributes.TEXT_MATCHING_MODE,
                TextMatchingMode.REGULAR_EXPRESSION);

        ICellPainter cellPainter = new CellPainterDecorator(new TextPainter() {
            {
                this.paintFg = false;
            }

            // override the preferred width and height to be 0, as otherwise
View Full Code Here

    private void addSelectedModeStyling(IConfigRegistry configRegistry) {
        Image selectedBgImage = new Image(Display.getDefault(), getClass()
                .getResourceAsStream("selected_column_header_bg.png"));

        TextPainter txtPainter = new TextPainter(false, false);
        ICellPainter selectedCellPainter = new BackgroundImagePainter(
                txtPainter, selectedBgImage, GUIHelper.getColor(192, 192, 192));
        // If sorting is enables we still want the sort icon to be drawn.
        SortableHeaderTextPainter selectedHeaderPainter = new SortableHeaderTextPainter(
                selectedCellPainter, false, true);
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.