Search in sources :

Example 6 with Style

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;
}
Also used : ColumnStyleEditorDialog(net.sourceforge.nattable.style.editor.ColumnStyleEditorDialog) ILayer(net.sourceforge.nattable.layer.ILayer) Style(net.sourceforge.nattable.style.Style)

Example 7 with Style

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));
}
Also used : Style(net.sourceforge.nattable.style.Style)

Example 8 with Style

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

the class DefaultSummaryRowConfiguration method addSummaryRowStyleConfig.

protected void addSummaryRowStyleConfig(IConfigRegistry configRegistry) {
    Style cellStyle = new Style();
    cellStyle.setAttributeValue(CellStyleAttributes.FONT, summaryRowFont);
    cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, summaryRowBgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, summaryRowFgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, summaryRowBorderStyle);
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, SummaryRowLayer.DEFAULT_SUMMARY_ROW_CONFIG_LABEL);
}
Also used : Style(net.sourceforge.nattable.style.Style) BorderStyle(net.sourceforge.nattable.style.BorderStyle)

Example 9 with Style

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

the class CellStyleEditorPanel method getNewValue.

@Override
public Style getNewValue() {
    Style newStyle = new Style();
    newStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, backgroundColorPicker.getSelectedColor());
    newStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, foregroundColorPicker.getSelectedColor());
    newStyle.setAttributeValue(CellStyleAttributes.FONT, fontPicker.getSelectedFont());
    newStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, horizontalAlignmentPicker.getSelectedAlignment());
    newStyle.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT, verticalAlignmentPicker.getSelectedAlignment());
    return newStyle;
}
Also used : Style(net.sourceforge.nattable.style.Style)

Example 10 with Style

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

the class DefaultSelectionStyleConfiguration method configureSelectionAnchorStyle.

protected void configureSelectionAnchorStyle(IConfigRegistry configRegistry) {
    // Selection anchor style for normal display mode
    Style cellStyle = new Style();
    cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, anchorBorderStyle);
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, SelectionStyleLabels.SELECTION_ANCHOR_STYLE);
    // Selection anchor style for select display mode
    cellStyle = new Style();
    cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, anchorBgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, anchorFgColor);
    cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, anchorBorderStyle);
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.SELECT, SelectionStyleLabels.SELECTION_ANCHOR_STYLE);
}
Also used : Style(net.sourceforge.nattable.style.Style) BorderStyle(net.sourceforge.nattable.style.BorderStyle)

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