Search in sources :

Example 1 with BorderStyle

use of net.sourceforge.nattable.style.BorderStyle in project translationstudio8 by heartsome.

the class StylePersistor method loadStyle.

// Load
public static Style loadStyle(String prefix, Properties properties) {
    Style style = new Style();
    prefix = prefix + DOT + STYLE_PERSISTENCE_PREFIX;
    // BG Color
    String bgColorPrefix = prefix + DOT + BG_COLOR_PREFIX;
    Color bgColor = loadColor(bgColorPrefix, properties);
    if (bgColor != null) {
        style.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, bgColor);
    }
    // FG Color
    String fgColorPrefix = prefix + DOT + FG_COLOR_PREFIX;
    Color fgColor = loadColor(fgColorPrefix, properties);
    if (fgColor != null) {
        style.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, fgColor);
    }
    // Alignment
    String hAlignPrefix = prefix + DOT + H_ALIGNMENT_PREFIX;
    HorizontalAlignmentEnum hAlign = loadHAlignment(hAlignPrefix, properties);
    if (hAlign != null) {
        style.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, hAlign);
    }
    String vAlignPrefix = prefix + DOT + V_ALIGNMENT_PREFIX;
    VerticalAlignmentEnum vAlign = loadVAlignment(vAlignPrefix, properties);
    if (vAlign != null) {
        style.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT, vAlign);
    }
    // Font
    String fontPrefix = prefix + DOT + FONT_PREFIX;
    Font font = loadFont(fontPrefix, properties);
    if (font != null) {
        style.setAttributeValue(CellStyleAttributes.FONT, font);
    }
    // Border Style
    String borderPrefix = prefix + DOT + BORDER_PREFIX;
    BorderStyle borderStyle = loadBorderStyle(borderPrefix, properties);
    if (borderStyle != null) {
        style.setAttributeValue(CellStyleAttributes.BORDER_STYLE, borderStyle);
    }
    return style;
}
Also used : HorizontalAlignmentEnum(net.sourceforge.nattable.style.HorizontalAlignmentEnum) BorderStyle(net.sourceforge.nattable.style.BorderStyle) Color(org.eclipse.swt.graphics.Color) Style(net.sourceforge.nattable.style.Style) BorderStyle(net.sourceforge.nattable.style.BorderStyle) VerticalAlignmentEnum(net.sourceforge.nattable.style.VerticalAlignmentEnum) Font(org.eclipse.swt.graphics.Font)

Example 2 with BorderStyle

use of net.sourceforge.nattable.style.BorderStyle in project translationstudio8 by heartsome.

the class DefaultColumnHeaderStyleConfiguration method configureRegistry.

public void configureRegistry(IConfigRegistry configRegistry) {
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter, DisplayMode.NORMAL, GridRegion.COLUMN_HEADER);
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter, DisplayMode.NORMAL, GridRegion.CORNER);
    // Normal
    Style cellStyle = new Style();
    cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, bgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, fgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, hAlign);
    cellStyle.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT, vAlign);
    cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, borderStyle);
    cellStyle.setAttributeValue(CellStyleAttributes.FONT, font);
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, GridRegion.COLUMN_HEADER);
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, GridRegion.CORNER);
}
Also used : Style(net.sourceforge.nattable.style.Style) BorderStyle(net.sourceforge.nattable.style.BorderStyle)

Example 3 with BorderStyle

use of net.sourceforge.nattable.style.BorderStyle in project translationstudio8 by heartsome.

the class DefaultRowHeaderStyleConfiguration method configureRowHeaderStyle.

protected void configureRowHeaderStyle(IConfigRegistry configRegistry) {
    Style cellStyle = new Style();
    cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, bgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, fgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, hAlign);
    cellStyle.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT, vAlign);
    cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, borderStyle);
    cellStyle.setAttributeValue(CellStyleAttributes.FONT, font);
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, GridRegion.ROW_HEADER);
}
Also used : Style(net.sourceforge.nattable.style.Style) BorderStyle(net.sourceforge.nattable.style.BorderStyle)

Example 4 with BorderStyle

use of net.sourceforge.nattable.style.BorderStyle in project translationstudio8 by heartsome.

the class LineBorderDecorator method getPreferredHeight.

public int getPreferredHeight(LayerCell cell, GC gc, IConfigRegistry configRegistry) {
    BorderStyle borderStyle = getBorderStyle(cell, configRegistry);
    int borderThickness = borderStyle != null ? borderStyle.getThickness() : 0;
    return super.getPreferredHeight(cell, gc, configRegistry) + (borderThickness * 2);
}
Also used : BorderStyle(net.sourceforge.nattable.style.BorderStyle)

Example 5 with BorderStyle

use of net.sourceforge.nattable.style.BorderStyle in project translationstudio8 by heartsome.

the class LineBorderDecorator method getBorderStyle.

private BorderStyle getBorderStyle(LayerCell cell, IConfigRegistry configRegistry) {
    IStyle cellStyle = CellStyleUtil.getCellStyle(cell, configRegistry);
    BorderStyle borderStyle = cellStyle.getAttributeValue(CellStyleAttributes.BORDER_STYLE);
    if (borderStyle == null) {
        borderStyle = defaultBorderStyle;
    }
    return borderStyle;
}
Also used : IStyle(net.sourceforge.nattable.style.IStyle) BorderStyle(net.sourceforge.nattable.style.BorderStyle)

Aggregations

BorderStyle (net.sourceforge.nattable.style.BorderStyle)9 Style (net.sourceforge.nattable.style.Style)4 Color (org.eclipse.swt.graphics.Color)3 DefaultDisplayConverter (net.sourceforge.nattable.data.convert.DefaultDisplayConverter)1 LineStyleEnum (net.sourceforge.nattable.style.BorderStyle.LineStyleEnum)1 HorizontalAlignmentEnum (net.sourceforge.nattable.style.HorizontalAlignmentEnum)1 IStyle (net.sourceforge.nattable.style.IStyle)1 VerticalAlignmentEnum (net.sourceforge.nattable.style.VerticalAlignmentEnum)1 Font (org.eclipse.swt.graphics.Font)1 Rectangle (org.eclipse.swt.graphics.Rectangle)1