Search in sources :

Example 11 with Style

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

the class XLIFFEditorImplWithNatTable method addFlagLableToColumn.

/**
	 * 配置标签列的显示效果
	 * @param configRegistry
	 *            配置注册表
	 */
private void addFlagLableToColumn(IConfigRegistry configRegistry) {
    // Edit by Leakey 实现状态图片的动态显示
    StatusPainter painter = new StatusPainter(bodyDataProvider);
    // CellPainterDecorator flagPainter = new CellPainterDecorator(new BackgroundPainter(), CellEdgeEnum.RIGHT,
    // painter);
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, painter, DisplayMode.NORMAL, FLAG_CELL_LABEL);
    // Set the color of the cell. This is picked up by the button painter to style the button
    Style style = new Style();
    FontData fd = GUIHelper.DEFAULT_FONT.getFontData()[0];
    fd.setStyle(SWT.BOLD);
    style.setAttributeValue(CellStyleAttributes.FONT, GUIHelper.getFont(fd));
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, style, DisplayMode.NORMAL, FLAG_CELL_LABEL);
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, style, DisplayMode.SELECT, FLAG_CELL_LABEL);
}
Also used : StatusPainter(net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.StatusPainter) FontData(org.eclipse.swt.graphics.FontData) TagStyle(net.heartsome.cat.common.innertag.TagStyle) Style(net.sourceforge.nattable.style.Style)

Example 12 with Style

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

the class DefaultRowStyleConfiguration method configureEvenRowStyle.

protected void configureEvenRowStyle(IConfigRegistry configRegistry) {
    Style cellStyle = new Style();
    cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, evenRowBgColor);
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, AlternatingRowConfigLabelAccumulator.ODD_ROW_CONFIG_TYPE);
}
Also used : Style(net.sourceforge.nattable.style.Style)

Example 13 with Style

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

the class DefaultRowStyleConfiguration method configureOddRowStyle.

protected void configureOddRowStyle(IConfigRegistry configRegistry) {
    Style cellStyle = new Style();
    cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, oddRowBgColor);
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, AlternatingRowConfigLabelAccumulator.EVEN_ROW_CONFIG_TYPE);
}
Also used : Style(net.sourceforge.nattable.style.Style)

Example 14 with Style

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

the class DefaultNatTableStyleConfiguration method configureRegistry.

public void configureRegistry(IConfigRegistry configRegistry) {
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter);
    Style cellStyle = new Style();
    cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, bgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, fgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.FONT, font);
    cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, hAlign);
    cellStyle.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT, vAlign);
    cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, borderStyle);
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle);
    configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new DefaultDisplayConverter());
}
Also used : Style(net.sourceforge.nattable.style.Style) BorderStyle(net.sourceforge.nattable.style.BorderStyle) DefaultDisplayConverter(net.sourceforge.nattable.data.convert.DefaultDisplayConverter)

Example 15 with Style

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

the class DisplayColumnStyleEditorCommandHandler method loadState.

public void loadState(String prefix, Properties properties) {
    prefix = prefix + DOT + PERSISTENCE_PREFIX;
    Set<Object> keySet = properties.keySet();
    for (Object key : keySet) {
        String keyString = (String) key;
        // Relevant Key
        if (keyString.contains(PERSISTENCE_PREFIX)) {
            int colIndex = parseColumnIndexFromKey(keyString);
            // Has the config label been processed
            if (!stylesToPersist.keySet().contains(getConfigLabel(colIndex))) {
                Style savedStyle = StylePersistor.loadStyle(prefix + DOT + getConfigLabel(colIndex), properties);
                configRegistry.registerConfigAttribute(CELL_STYLE, savedStyle, NORMAL, getConfigLabel(colIndex));
                stylesToPersist.put(getConfigLabel(colIndex), savedStyle);
            }
        }
    }
}
Also used : Style(net.sourceforge.nattable.style.Style)

Aggregations

Style (net.sourceforge.nattable.style.Style)19 BorderStyle (net.sourceforge.nattable.style.BorderStyle)9 TagStyle (net.heartsome.cat.common.innertag.TagStyle)3 HashMap (java.util.HashMap)1 Map (java.util.Map)1 XLIFFEditorCompositeLayerConfiguration (net.heartsome.cat.ts.ui.xliffeditor.nattable.config.XLIFFEditorCompositeLayerConfiguration)1 LineNumberPainter (net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.LineNumberPainter)1 StatusPainter (net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.StatusPainter)1 DefaultDisplayConverter (net.sourceforge.nattable.data.convert.DefaultDisplayConverter)1 ILayer (net.sourceforge.nattable.layer.ILayer)1 HorizontalAlignmentEnum (net.sourceforge.nattable.style.HorizontalAlignmentEnum)1 VerticalAlignmentEnum (net.sourceforge.nattable.style.VerticalAlignmentEnum)1 ColumnStyleEditorDialog (net.sourceforge.nattable.style.editor.ColumnStyleEditorDialog)1 Color (org.eclipse.swt.graphics.Color)1 Font (org.eclipse.swt.graphics.Font)1 FontData (org.eclipse.swt.graphics.FontData)1