use of net.sourceforge.nattable.style.VerticalAlignmentEnum 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.VerticalAlignmentEnum in project translationstudio8 by heartsome.
the class CellStyleEditorPanel method edit.
@Override
public void edit(Style style) throws Exception {
Color bgColor = style.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR);
backgroundColorPicker.setSelectedColor(bgColor != null ? bgColor : GUIHelper.COLOR_WHITE);
Color fgColor = style.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR);
foregroundColorPicker.setSelectedColor(fgColor != null ? fgColor : GUIHelper.COLOR_BLACK);
fontPicker.setFont(style.getAttributeValue(CellStyleAttributes.FONT));
HorizontalAlignmentEnum hAlign = style.getAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT);
horizontalAlignmentPicker.setSelectedAlignment(hAlign != null ? hAlign : HorizontalAlignmentEnum.CENTER);
VerticalAlignmentEnum vAlign = style.getAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT);
verticalAlignmentPicker.setSelectedAlignment(vAlign != null ? vAlign : VerticalAlignmentEnum.MIDDLE);
}
Aggregations