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;
}
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);
}
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);
}
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);
}
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;
}
Aggregations