Class CellStyleUtil
java.lang.Object
org.eclipse.nebula.widgets.nattable.style.CellStyleUtil
Helper class to handle cell styles.
-
Method Summary
Modifier and TypeMethodDescriptionstatic List<org.eclipse.swt.graphics.Color> getAllBackgroundColors(ILayerCell cell, IConfigRegistry configRegistry, String displayMode) Deprecated.static List<org.eclipse.swt.graphics.Color> getAllBackgroundColors(ILayerCell cell, IConfigRegistry configRegistry, DisplayMode displayMode) Collects all background colors configured for the givenILayerCell.static IStylegetCellStyle(ILayerCell cell, IConfigRegistry configRegistry) Return anIStylefor a cell that contains the transitive style informations.static org.eclipse.swt.graphics.FontgetFont(IStyle cellStyle, IConfigRegistry configRegistry) Extracts theFontfrom the given cell style and returns a scaled variant if needed.static intgetHorizontalAlignmentPadding(HorizontalAlignmentEnum horizontalAlignment, org.eclipse.swt.graphics.Rectangle rectangle, int contentWidth) Calculates the padding needed at the left for horizontal alignment.static intgetHorizontalAlignmentPadding(IStyle cellStyle, org.eclipse.swt.graphics.Rectangle rectangle, int contentWidth) Calculates the padding needed at the left for horizontal alignment.static intgetVerticalAlignmentPadding(IStyle cellStyle, org.eclipse.swt.graphics.Rectangle rectangle, int contentHeight) Calculates the padding needed at the top for vertical alignment.static intgetVerticalAlignmentPadding(VerticalAlignmentEnum verticalAlignment, org.eclipse.swt.graphics.Rectangle rectangle, int contentHeight) Calculates the padding needed at the top for vertical alignment.
-
Method Details
-
getCellStyle
Return anIStylefor a cell that contains the transitive style informations.- Parameters:
cell- TheILayerCellfor which the style information is requested.configRegistry- TheIConfigRegistryneeded to retrieve the transitive style information.- Returns:
- The transitive style information for the given cell.
-
getHorizontalAlignmentPadding
public static int getHorizontalAlignmentPadding(IStyle cellStyle, org.eclipse.swt.graphics.Rectangle rectangle, int contentWidth) Calculates the padding needed at the left for horizontal alignment.- Parameters:
cellStyle- The style information from which the horizontal alignment configuration is extracted.rectangle- The rectangle to paint into.contentWidth- The width of the content that should be painted into the rectangle.- Returns:
- The padding needed at the left to align the content horizontally.
-
getHorizontalAlignmentPadding
public static int getHorizontalAlignmentPadding(HorizontalAlignmentEnum horizontalAlignment, org.eclipse.swt.graphics.Rectangle rectangle, int contentWidth) Calculates the padding needed at the left for horizontal alignment.- Parameters:
horizontalAlignment- The horizontal alignment that should be applied. Defaults toHorizontalAlignmentEnum.CENTERifnull.rectangle- The rectangle to paint into.contentWidth- The width of the content that should be painted into the rectangle.- Returns:
- The padding needed at the left to align the content horizontally.
-
getVerticalAlignmentPadding
public static int getVerticalAlignmentPadding(IStyle cellStyle, org.eclipse.swt.graphics.Rectangle rectangle, int contentHeight) Calculates the padding needed at the top for vertical alignment.- Parameters:
cellStyle- The style information from which the vertical alignment configuration is extracted.rectangle- The rectangle to paint into.contentHeight- The height of the content that should be painted into the rectangle.- Returns:
- The padding needed at the top to align the content vertically.
-
getVerticalAlignmentPadding
public static int getVerticalAlignmentPadding(VerticalAlignmentEnum verticalAlignment, org.eclipse.swt.graphics.Rectangle rectangle, int contentHeight) Calculates the padding needed at the top for vertical alignment.- Parameters:
verticalAlignment- The vertical alignment that should be applied. Defaults toVerticalAlignmentEnum.MIDDLEifnull.rectangle- The rectangle to paint into.contentHeight- The height of the content that should be painted into the rectangle.- Returns:
- The padding needed at the top to align the content vertically.
-
getAllBackgroundColors
@Deprecated public static List<org.eclipse.swt.graphics.Color> getAllBackgroundColors(ILayerCell cell, IConfigRegistry configRegistry, String displayMode) Deprecated.Collects all background colors configured for the givenILayerCell.- Parameters:
cell- TheILayerCellfor which the background colors are requested.configRegistry- TheIConfigRegistryneeded to retrieve the transitive style information.displayMode- TheDisplayModefor which the background color configuration is requested.- Returns:
- The collection of all background colors that are configured transitively for the given cell.
-
getAllBackgroundColors
public static List<org.eclipse.swt.graphics.Color> getAllBackgroundColors(ILayerCell cell, IConfigRegistry configRegistry, DisplayMode displayMode) Collects all background colors configured for the givenILayerCell.- Parameters:
cell- TheILayerCellfor which the background colors are requested.configRegistry- TheIConfigRegistryneeded to retrieve the transitive style information.displayMode- TheDisplayModefor which the background color configuration is requested.- Returns:
- The collection of all background colors that are configured transitively for the given cell.
- Since:
- 2.0
-
getFont
public static org.eclipse.swt.graphics.Font getFont(IStyle cellStyle, IConfigRegistry configRegistry) Extracts theFontfrom the given cell style and returns a scaled variant if needed.- Parameters:
cellStyle- TheIStyleto extract theFontfrom.configRegistry- TheIConfigRegistryneeded to check for the scaling factor.- Returns:
- The
Fontto use. - Since:
- 2.0
-
getAllBackgroundColors(ILayerCell, IConfigRegistry, DisplayMode)