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

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


    private void addNormalModeStyling(IConfigRegistry configRegistry) {
        Image bgImage = new Image(Display.getDefault(), getClass()
                .getResourceAsStream("column_header_bg.png"));

        TextPainter txtPainter = new TextPainter(false, false);
        ICellPainter bgImagePainter = new BackgroundImagePainter(txtPainter,
                bgImage, GUIHelper.getColor(192, 192, 192));
        SortableHeaderTextPainter headerPainter = new SortableHeaderTextPainter(
                bgImagePainter, false, true);

        configRegistry.registerConfigAttribute(
View Full Code Here


            protected void paintCell(ILayerCell cell, GC gc,
                    IConfigRegistry configRegistry) {
                ILayer layer = cell.getLayer();
                int columnPosition = cell.getColumnPosition();
                int rowPosition = cell.getRowPosition();
                ICellPainter cellPainter = layer.getCellPainter(columnPosition,
                        rowPosition, cell, configRegistry);
                Rectangle adjustedCellBounds = layer.getLayerPainter()
                        .adjustCellBounds(columnPosition, rowPosition,
                                cell.getBounds());
                if (cellPainter != null) {
                    Rectangle originalClipping = gc.getClipping();

                    int startX = getStartXOfColumnPosition(columnPosition);
                    int startY = getStartYOfRowPosition(rowPosition);

                    int endX = getStartXOfColumnPosition(cell
                            .getOriginColumnPosition() + cell.getColumnSpan());
                    int endY = getStartYOfRowPosition(cell
                            .getOriginRowPosition() + cell.getRowSpan());

                    // correct position of first column in right region
                    // find the last visible column in left region
                    int viewportBorderX = bodyLayer.getViewportLayerLeft()
                            .getClientAreaWidth() + rowHeaderLayer.getWidth();
                    if (isClipLeft(columnPosition) && startX < viewportBorderX) {
                        startX = viewportBorderX;
                    }
                    if (!isClipLeft(columnPosition - 1)
                            && startX > viewportBorderX) {
                        startX = viewportBorderX;
                    }
                    if (isClipLeft(cell.getOriginColumnPosition()
                            + cell.getColumnSpan())
                            && endX < viewportBorderX) {
                        endX = viewportBorderX;
                    }

                    Rectangle cellClipBounds = originalClipping
                            .intersection(new Rectangle(startX, startY, endX
                                    - startX, endY - startY));
                    gc.setClipping(cellClipBounds
                            .intersection(adjustedCellBounds));

                    cellPainter.paintCell(cell, gc, adjustedCellBounds,
                            configRegistry);

                    gc.setClipping(originalClipping);
                }
            }
View Full Code Here

                            .getResourceAsStream(
                                    "/org/eclipse/nebula/widgets/nattable/examples/resources/selected_hovered_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, selectedHeaderPainter,
                    DisplayMode.SELECT, GridRegion.COLUMN_HEADER);

            ICellPainter selectedHoveredHeaderPainter = new BackgroundImagePainter(
                    txtPainter, selectedHoveredBgImage, GUIHelper.getColor(192,
                            192, 192));

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

            configRegistry.registerConfigAttribute(
                    CellConfigAttributes.CELL_STYLE, rowGroupHeaderStyle,
                    DisplayMode.NORMAL, GridRegion.ROW_GROUP_HEADER);
        }

        ICellPainter rowGroupHeaderCellPainter = getRowGroupHeaderCellPainter();
        if (rowGroupHeaderCellPainter != null) {
            configRegistry.registerConfigAttribute(
                    CellConfigAttributes.CELL_PAINTER,
                    rowGroupHeaderCellPainter, DisplayMode.NORMAL,
                    GridRegion.ROW_GROUP_HEADER);
View Full Code Here

                    CellConfigAttributes.CELL_STYLE, sortStyle,
                    DisplayMode.NORMAL,
                    DefaultSortConfiguration.SORT_UP_CONFIG_TYPE);
        }

        ICellPainter cellPainter = getSortHeaderCellPainter();
        if (cellPainter != null) {
            configRegistry.registerConfigAttribute(
                    CellConfigAttributes.CELL_PAINTER, cellPainter,
                    DisplayMode.NORMAL,
                    DefaultSortConfiguration.SORT_DOWN_CONFIG_TYPE);
View Full Code Here

                    CellConfigAttributes.CELL_STYLE, sortStyle,
                    DisplayMode.SELECT,
                    DefaultSortConfiguration.SORT_UP_CONFIG_TYPE);
        }

        ICellPainter cellPainter = getSelectedSortHeaderCellPainter();
        if (cellPainter != null) {
            configRegistry.registerConfigAttribute(
                    CellConfigAttributes.CELL_PAINTER, cellPainter,
                    DisplayMode.SELECT,
                    DefaultSortConfiguration.SORT_DOWN_CONFIG_TYPE);
View Full Code Here

            configRegistry.registerConfigAttribute(
                    CellConfigAttributes.CELL_STYLE, filterRowStyle,
                    DisplayMode.NORMAL, GridRegion.FILTER_ROW);
        }

        ICellPainter cellPainter = getFilterRowCellPainter();
        if (cellPainter != null) {
            configRegistry.registerConfigAttribute(
                    CellConfigAttributes.CELL_PAINTER, cellPainter,
                    DisplayMode.NORMAL, GridRegion.FILTER_ROW);
        }
View Full Code Here

            configRegistry.registerConfigAttribute(
                    CellConfigAttributes.CELL_STYLE, treeStyle,
                    DisplayMode.NORMAL, TreeLayer.TREE_COLUMN_CELL);
        }

        ICellPainter cellPainter = getTreeCellPainter();
        if (cellPainter != null) {
            configRegistry.registerConfigAttribute(
                    CellConfigAttributes.CELL_PAINTER, cellPainter,
                    DisplayMode.NORMAL, TreeLayer.TREE_COLUMN_CELL);
        }

        IStyle treeSelectionStyle = getTreeSelectionStyle();
        if (!isStyleEmpty(treeSelectionStyle)) {
            configRegistry.registerConfigAttribute(
                    CellConfigAttributes.CELL_STYLE, treeSelectionStyle,
                    DisplayMode.SELECT, TreeLayer.TREE_COLUMN_CELL);
        }

        ICellPainter selectionCellPainter = getTreeSelectionCellPainter();
        if (selectionCellPainter != null) {
            configRegistry.registerConfigAttribute(
                    CellConfigAttributes.CELL_PAINTER, selectionCellPainter,
                    DisplayMode.SELECT, TreeLayer.TREE_COLUMN_CELL);
        }

        ICellPainter treePainter = getTreeStructurePainter();
        if (treePainter != null) {
            configRegistry.registerConfigAttribute(
                    TreeConfigAttributes.TREE_STRUCTURE_PAINTER, treePainter,
                    DisplayMode.NORMAL);
        }

        ICellPainter treeSelectionPainter = getTreeStructureSelectionPainter();
        if (treeSelectionPainter != null) {
            configRegistry.registerConfigAttribute(
                    TreeConfigAttributes.TREE_STRUCTURE_PAINTER,
                    treeSelectionPainter, DisplayMode.SELECT);
        }
View Full Code Here

            configRegistry.registerConfigAttribute(
                    CellConfigAttributes.CELL_STYLE, style, DisplayMode.NORMAL,
                    SummaryRowLayer.DEFAULT_SUMMARY_ROW_CONFIG_LABEL);
        }

        ICellPainter cellPainter = getSummaryRowCellPainter();
        if (cellPainter != null) {
            configRegistry.registerConfigAttribute(
                    CellConfigAttributes.CELL_PAINTER, cellPainter,
                    DisplayMode.NORMAL,
                    SummaryRowLayer.DEFAULT_SUMMARY_ROW_CONFIG_LABEL);
View Full Code Here

                // between cell
                // border and tree icons.
                TreeImagePainter treeImagePainter = new TreeImagePainter(
                        false,
                        GUIHelper.getImage("right"), GUIHelper.getImage("right_down"), null); //$NON-NLS-1$//$NON-NLS-2$
                ICellPainter treeStructurePainter = new BackgroundPainter(
                        new PaddingDecorator(new IndentedTreeImagePainter(10,
                                null, CellEdgeEnum.LEFT, treeImagePainter,
                                false, 2, true), 0, 5, 0, 5, false));

                configRegistry.registerConfigAttribute(
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.