Package org.eclipse.nebula.widgets.nattable.style

Examples of org.eclipse.nebula.widgets.nattable.style.IStyle


                CellConfigAttributes.DISPLAY_CONVERTER,
                new DefaultDateDisplayConverter(), DisplayMode.EDIT,
                CrossValidationGridExample.DATE_LABEL);

        // configure the validation error style
        IStyle validationErrorStyle = new Style();
        validationErrorStyle.setAttributeValue(
                CellStyleAttributes.BACKGROUND_COLOR, GUIHelper.COLOR_RED);
        validationErrorStyle.setAttributeValue(
                CellStyleAttributes.FOREGROUND_COLOR, GUIHelper.COLOR_WHITE);

        configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE,
                validationErrorStyle, DisplayMode.NORMAL,
                CrossValidationGridExample.INVALID_LABEL);
View Full Code Here


        // Draw background
        gc.fillRectangle(bounds);

        groupByCellBounds.clear();

        IStyle cellStyle = CellStyleUtil.getCellStyle(cell, configRegistry);
        gc.setBackground(cellStyle
                .getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR));
        gc.setForeground(cellStyle
                .getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR));
        gc.setFont(cellStyle.getAttributeValue(CellStyleAttributes.FONT));
        gc.setAntialias(GUIHelper.DEFAULT_ANTIALIAS);
        gc.setTextAntialias(GUIHelper.DEFAULT_TEXT_ANTIALIAS);

        List<Integer> groupByColumnIndexes = groupByModel
                .getGroupByColumnIndexes();
        if (groupByColumnIndexes.size() > 0) {

            int textHeight = gc.textExtent("X").y; //$NON-NLS-1$

            int x0 = bounds.x + LEFT_INDENT;
            int y0 = bounds.y + bounds.height / 2 - textHeight / 2 - Y_PADDING;
            int y_height = Y_PADDING + textHeight + Y_PADDING;

            // Draw leftmost edge
            gc.drawLine(x0, y0, x0, y0 + y_height);
            x0++;

            // Draw group by columns
            int lastColumnIndex = groupByColumnIndexes.size() - 1;
            for (int i = 0; i <= lastColumnIndex; i++) {
                int columnIndex = groupByColumnIndexes.get(i);

                String columnName = (String) columnHeaderDataProvider
                        .getDataValue(columnIndex, 0);
                int textWidth = gc.textExtent(columnName).x;

                groupByCellBounds.add(new Rectangle(x0, y0, X_PADDING
                        + textWidth + X_PADDING, y_height));

                gc.fillRectangle(x0, y0, X_PADDING + textWidth + X_PADDING,
                        y_height);
                gc.drawLine(x0, y0, x0 + X_PADDING + textWidth + X_PADDING, y0);
                gc.drawLine(x0, y0 + y_height, x0 + X_PADDING + textWidth
                        + X_PADDING, y0 + y_height);

                gc.drawText(columnName, x0 + X_PADDING, y0 + Y_PADDING);

                x0 += X_PADDING + textWidth + X_PADDING;

                // Draw end cap
                if (i < lastColumnIndex) {
                    gc.fillRectangle(x0, y0, ENDCAP_WIDTH, y_height);
                    gc.drawLine(x0, y0, x0 + ENDCAP_WIDTH, y0);
                    gc.drawLine(x0, y0 + y_height, x0 + ENDCAP_WIDTH, y0
                            + y_height);
                } else {
                    gc.fillPolygon(new int[] { x0, y0, x0 + ENDCAP_WIDTH,
                            y0 + y_height / 2, x0, y0 + y_height });
                }
                gc.drawLine(x0, y0, x0 + ENDCAP_WIDTH - 1, y0 + y_height / 2);
                gc.drawLine(x0, y0 + y_height, x0 + ENDCAP_WIDTH - 1, y0
                        + y_height / 2);

                x0 += ENDCAP_WIDTH;
            }
        } else {
            // if no grouping is applied and a hint is specified via
            // configuration, the hint is rendered
            String hint = configRegistry.getConfigAttribute(
                    GroupByConfigAttributes.GROUP_BY_HINT, DisplayMode.NORMAL);
            if (hint != null) {
                // check if there is a separate styling configured for the hint
                IStyle hintStyle = configRegistry.getConfigAttribute(
                        GroupByConfigAttributes.GROUP_BY_HINT_STYLE,
                        DisplayMode.NORMAL);
                if (hintStyle != null) {
                    Color hintBackground = hintStyle
                            .getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR);
                    gc.setBackground(hintBackground != null ? hintBackground
                            : originalBackground);
                    Color hintForeground = hintStyle
                            .getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR);
                    if (hintForeground != null)
                        gc.setForeground(hintForeground);
                    Font hintFont = hintStyle
                            .getAttributeValue(CellStyleAttributes.FONT);
                    if (hintFont != null)
                        gc.setFont(hintFont);
                } else {
                    // ensure the background is the same as the background of
View Full Code Here

        return this.sortHeaderCellPainter;
    }

    @Override
    protected IStyle getSelectedSortHeaderStyle() {
        IStyle cellStyle = new Style();
        cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR,
                selectedSortHeaderBgColor);
        cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR,
                selectedSortHeaderFgColor);
        cellStyle.setAttributeValue(
                CellStyleAttributes.GRADIENT_BACKGROUND_COLOR,
                selectedSortHeaderGradientBgColor);
        cellStyle.setAttributeValue(
                CellStyleAttributes.GRADIENT_FOREGROUND_COLOR,
                selectedSortHeaderGradientFgColor);
        cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT,
                selectedSortHeaderHAlign);
        cellStyle.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT,
                selectedSortHeaderVAlign);
        cellStyle.setAttributeValue(CellStyleAttributes.FONT,
                selectedSortHeaderFont);
        cellStyle.setAttributeValue(CellStyleAttributes.IMAGE,
                selectedSortHeaderImage);
        cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE,
                selectedSortHeaderBorderStyle);
        cellStyle.setAttributeValue(CellStyleAttributes.PASSWORD_ECHO_CHAR,
                selectedSortHeaderPWEchoChar);
        cellStyle.setAttributeValue(CellStyleAttributes.TEXT_DECORATION,
                selectedSortHeaderTextDecoration);
        return cellStyle;
    }
View Full Code Here

        return this.selectedSortHeaderCellPainter;
    }

    @Override
    protected IStyle getFilterRowStyle() {
        IStyle cellStyle = new Style();
        cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR,
                filterRowBgColor);
        cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR,
                filterRowFgColor);
        cellStyle.setAttributeValue(
                CellStyleAttributes.GRADIENT_BACKGROUND_COLOR,
                filterRowGradientBgColor);
        cellStyle.setAttributeValue(
                CellStyleAttributes.GRADIENT_FOREGROUND_COLOR,
                filterRowGradientFgColor);
        cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT,
                filterRowHAlign);
        cellStyle.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT,
                filterRowVAlign);
        cellStyle.setAttributeValue(CellStyleAttributes.FONT, filterRowFont);
        cellStyle.setAttributeValue(CellStyleAttributes.IMAGE, filterRowImage);
        cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE,
                filterRowBorderStyle);
        cellStyle.setAttributeValue(CellStyleAttributes.PASSWORD_ECHO_CHAR,
                filterRowPWEchoChar);
        cellStyle.setAttributeValue(CellStyleAttributes.TEXT_DECORATION,
                filterRowTextDecoration);
        return cellStyle;
    }
View Full Code Here

        return this.filterRowCellPainter;
    }

    @Override
    protected IStyle getTreeStyle() {
        IStyle cellStyle = new Style();
        cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR,
                treeBgColor);
        cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR,
                treeFgColor);
        cellStyle.setAttributeValue(
                CellStyleAttributes.GRADIENT_BACKGROUND_COLOR,
                treeGradientBgColor);
        cellStyle.setAttributeValue(
                CellStyleAttributes.GRADIENT_FOREGROUND_COLOR,
                treeGradientFgColor);
        cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT,
                treeHAlign);
        cellStyle.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT,
                treeVAlign);
        cellStyle.setAttributeValue(CellStyleAttributes.FONT, treeFont);
        cellStyle.setAttributeValue(CellStyleAttributes.IMAGE, treeImage);
        cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE,
                treeBorderStyle);
        cellStyle.setAttributeValue(CellStyleAttributes.PASSWORD_ECHO_CHAR,
                treePWEchoChar);
        cellStyle.setAttributeValue(CellStyleAttributes.TEXT_DECORATION,
                treeTextDecoration);
        return cellStyle;
    }
View Full Code Here

        return this.treeCellPainter;
    }

    @Override
    protected IStyle getTreeSelectionStyle() {
        IStyle cellStyle = new Style();
        cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR,
                treeSelectionBgColor);
        cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR,
                treeSelectionFgColor);
        cellStyle.setAttributeValue(
                CellStyleAttributes.GRADIENT_BACKGROUND_COLOR,
                treeSelectionGradientBgColor);
        cellStyle.setAttributeValue(
                CellStyleAttributes.GRADIENT_FOREGROUND_COLOR,
                treeSelectionGradientFgColor);
        cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT,
                treeSelectionHAlign);
        cellStyle.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT,
                treeSelectionVAlign);
        cellStyle
                .setAttributeValue(CellStyleAttributes.FONT, treeSelectionFont);
        cellStyle.setAttributeValue(CellStyleAttributes.IMAGE,
                treeSelectionImage);
        cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE,
                treeSelectionBorderStyle);
        cellStyle.setAttributeValue(CellStyleAttributes.PASSWORD_ECHO_CHAR,
                treeSelectionPWEchoChar);
        cellStyle.setAttributeValue(CellStyleAttributes.TEXT_DECORATION,
                treeSelectionTextDecoration);
        return cellStyle;
    }
View Full Code Here

        return this.treeStructureSelectionPainter;
    }

    @Override
    protected IStyle getSummaryRowStyle() {
        IStyle cellStyle = new Style();
        cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR,
                summaryRowBgColor);
        cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR,
                summaryRowFgColor);
        cellStyle.setAttributeValue(
                CellStyleAttributes.GRADIENT_BACKGROUND_COLOR,
                summaryRowGradientBgColor);
        cellStyle.setAttributeValue(
                CellStyleAttributes.GRADIENT_FOREGROUND_COLOR,
                summaryRowGradientFgColor);
        cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT,
                summaryRowHAlign);
        cellStyle.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT,
                summaryRowVAlign);
        cellStyle.setAttributeValue(CellStyleAttributes.FONT, summaryRowFont);
        cellStyle.setAttributeValue(CellStyleAttributes.IMAGE, summaryRowImage);
        cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE,
                summaryRowBorderStyle);
        cellStyle.setAttributeValue(CellStyleAttributes.PASSWORD_ECHO_CHAR,
                summaryRowPWEchoChar);
        cellStyle.setAttributeValue(CellStyleAttributes.TEXT_DECORATION,
                summaryRowTextDecoration);
        return cellStyle;
    }
View Full Code Here

        return this.summaryRowCellPainter;
    }

    @Override
    protected IStyle getSummaryRowSelectionStyle() {
        IStyle cellStyle = new Style();
        cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR,
                summaryRowSelectionBgColor);
        cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR,
                summaryRowSelectionFgColor);
        cellStyle.setAttributeValue(
                CellStyleAttributes.GRADIENT_BACKGROUND_COLOR,
                summaryRowSelectionGradientBgColor);
        cellStyle.setAttributeValue(
                CellStyleAttributes.GRADIENT_FOREGROUND_COLOR,
                summaryRowSelectionGradientFgColor);
        cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT,
                summaryRowSelectionHAlign);
        cellStyle.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT,
                summaryRowSelectionVAlign);
        cellStyle.setAttributeValue(CellStyleAttributes.FONT,
                summaryRowSelectionFont);
        cellStyle.setAttributeValue(CellStyleAttributes.IMAGE,
                summaryRowSelectionImage);
        cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE,
                summaryRowSelectionBorderStyle);
        cellStyle.setAttributeValue(CellStyleAttributes.PASSWORD_ECHO_CHAR,
                summaryRowSelectionPWEchoChar);
        cellStyle.setAttributeValue(CellStyleAttributes.TEXT_DECORATION,
                summaryRowSelectionTextDecoration);
        return cellStyle;
    }
View Full Code Here

        return this.renderFilterRowGridLines;
    }

    @Override
    protected IStyle getConversionErrorStyle() {
        IStyle cellStyle = new Style();
        cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR,
                conversionErrorBgColor);
        cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR,
                conversionErrorFgColor);
        cellStyle.setAttributeValue(CellStyleAttributes.FONT,
                conversionErrorFont);
        return cellStyle;
    }
View Full Code Here

        return cellStyle;
    }

    @Override
    protected IStyle getValidationErrorStyle() {
        IStyle cellStyle = new Style();
        cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR,
                validationErrorBgColor);
        cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR,
                validationErrorFgColor);
        cellStyle.setAttributeValue(CellStyleAttributes.FONT,
                validationErrorFont);
        return cellStyle;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.style.IStyle

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.