use of org.eclipse.nebula.widgets.nattable.style.BorderStyle in project nebula.widgets.nattable by eclipse.
the class FillHandleLayerPainter method applyHandleBorderStyle.
/**
* Apply the border style that should be used to render the border for cells
* that are currently part of the fill handle region. Checks the
* {@link IConfigRegistry} for a registered {@link IStyle} for the
* {@link FillHandleConfigAttributes#FILL_HANDLE_REGION_BORDER_STYLE} label.
* If none is registered, a default line style will be used to render the
* border.
*
* @param gc
* The current {@link GC} that is used for rendering.
* @param configRegistry
* The {@link IConfigRegistry} to retrieve the style information
* from.
* @deprecated Use {@link #getHandleRegionBorderStyle} instead.
*/
@Deprecated
protected void applyHandleBorderStyle(GC gc, IConfigRegistry configRegistry) {
BorderStyle borderStyle = configRegistry.getConfigAttribute(FillHandleConfigAttributes.FILL_HANDLE_REGION_BORDER_STYLE, DisplayMode.NORMAL);
// if there is no border style configured, use the default
if (borderStyle == null) {
gc.setLineStyle(SWT.LINE_SOLID);
gc.setLineWidth(2);
gc.setForeground(GUIHelper.getColor(0, 125, 10));
} else {
gc.setLineStyle(LineStyleEnum.toSWT(borderStyle.getLineStyle()));
gc.setLineWidth(borderStyle.getThickness());
gc.setForeground(borderStyle.getColor());
}
}
use of org.eclipse.nebula.widgets.nattable.style.BorderStyle in project nebula.widgets.nattable by eclipse.
the class CustomLineBorderDecorator method getPreferredWidth.
@Override
public int getPreferredWidth(ILayerCell cell, GC gc, IConfigRegistry configRegistry) {
BorderStyle borderStyle = getBorderStyle(cell, configRegistry);
int borderThickness = borderStyle != null ? borderStyle.getThickness() : 0;
int borderLineCount = 0;
// check how many border lines are configured for that cell
List<String> labels = cell.getConfigLabels().getLabels();
if (labels.contains(RIGHT_LINE_BORDER_LABEL))
borderLineCount++;
if (labels.contains(LEFT_LINE_BORDER_LABEL))
borderLineCount++;
return super.getPreferredWidth(cell, gc, configRegistry) + (borderThickness * borderLineCount);
}
use of org.eclipse.nebula.widgets.nattable.style.BorderStyle in project nebula.widgets.nattable by eclipse.
the class LineBorderDecorator method getBorderStyle.
private BorderStyle getBorderStyle(ILayerCell cell, IConfigRegistry configRegistry) {
IStyle cellStyle = CellStyleUtil.getCellStyle(cell, configRegistry);
BorderStyle borderStyle = cellStyle.getAttributeValue(CellStyleAttributes.BORDER_STYLE);
if (borderStyle == null) {
borderStyle = this.defaultBorderStyle;
}
return borderStyle;
}
use of org.eclipse.nebula.widgets.nattable.style.BorderStyle in project nebula.widgets.nattable by eclipse.
the class LineBorderDecorator method getPreferredHeight.
@Override
public int getPreferredHeight(ILayerCell 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 org.eclipse.nebula.widgets.nattable.style.BorderStyle in project nebula.widgets.nattable by eclipse.
the class SelectionLayerPainter method getBorderStyle.
/**
* Get the border style that should be used to render the border for cells
* that are currently selected. Checks the {@link IConfigRegistry} for a
* registered {@link IStyle} for the
* {@link SelectionConfigAttributes#SELECTION_GRID_LINE_STYLE} label or the
* {@link SelectionStyleLabels#SELECTION_ANCHOR_GRID_LINE_STYLE} label. If
* none is registered, a default line style will be returned.
*
* @param configRegistry
* The {@link IConfigRegistry} to retrieve the style information
* from.
*
* @return The border style that should be used
*
* @since 1.5
*/
protected BorderStyle getBorderStyle(IConfigRegistry configRegistry) {
BorderStyle borderStyle = configRegistry.getConfigAttribute(SelectionConfigAttributes.SELECTION_GRID_LINE_STYLE, DisplayMode.SELECT);
// check for backwards compatibility style configuration
if (borderStyle == null) {
// Note: If there is no style configured for the
// SelectionStyleLabels.SELECTION_ANCHOR_GRID_LINE_STYLE
// label, the style configured for DisplayMode.SELECT will be
// retrieved by this call.
// Ensure that the selection style configuration does not contain a
// border style configuration to avoid strange rendering behavior.
// By default there is no border configuration added, so there
// shouldn't be issues with backwards compatibility. And if there
// are some, they can be solved easily by adding the necessary
// border style configuration.
IStyle cellStyle = configRegistry.getConfigAttribute(CellConfigAttributes.CELL_STYLE, DisplayMode.SELECT, SelectionStyleLabels.SELECTION_ANCHOR_GRID_LINE_STYLE);
borderStyle = cellStyle != null ? cellStyle.getAttributeValue(CellStyleAttributes.BORDER_STYLE) : null;
}
// if there is no border style configured, use the default
if (borderStyle == null) {
borderStyle = new BorderStyle(1, GUIHelper.COLOR_BLACK, LineStyleEnum.DOTTED, BorderModeEnum.CENTERED);
}
return borderStyle;
}
Aggregations