use of net.sourceforge.nattable.style.Style 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.Style 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.Style 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.Style in project translationstudio8 by heartsome.
the class DisplayColumnStyleEditorCommandHandler method doCommand.
@Override
public boolean doCommand(DisplayColumnStyleEditorCommand command) {
ILayer nattableLayer = command.getNattableLayer();
int columnIndex = nattableLayer.getColumnIndexByPosition(command.columnPosition);
// Column style
Style slectedCellStyle = (Style) configRegistry.getConfigAttribute(CELL_STYLE, NORMAL, USER_EDITED_STYLE_LABEL + columnIndex);
dialog = new ColumnStyleEditorDialog(Display.getCurrent().getActiveShell(), slectedCellStyle);
dialog.open();
if (dialog.isCancelPressed()) {
return true;
}
applySelectedStyleToColumn(command, columnIndex);
return true;
}
use of net.sourceforge.nattable.style.Style in project translationstudio8 by heartsome.
the class DisplayColumnStyleEditorCommandHandler method applySelectedStyleToColumn.
protected void applySelectedStyleToColumn(DisplayColumnStyleEditorCommand command, int columnIndex) {
// Read the edited styles
Style newColumnCellStyle = dialog.getNewColumCellStyle();
if (newColumnCellStyle == null) {
stylesToPersist.remove(getConfigLabel(columnIndex));
} else {
newColumnCellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, dialog.getNewColumnBorderStyle());
stylesToPersist.put(getConfigLabel(columnIndex), newColumnCellStyle);
}
configRegistry.registerConfigAttribute(CELL_STYLE, newColumnCellStyle, NORMAL, getConfigLabel(columnIndex));
columnLabelAccumulator.registerColumnOverrides(columnIndex, getConfigLabel(columnIndex));
}
Aggregations