public class NatTableCSSHelper extends Object
| Constructor and Description |
|---|
NatTableCSSHelper() |
| Modifier and Type | Method and Description |
|---|---|
static <T> void |
applyNatTableStyle(NatTable natTable,
ConfigAttribute<IStyle> styleAttribute,
ConfigAttribute<T> styleConfig,
T value,
String displayMode,
String configLabel)
Apply a style attribute value for the
IStyle registered for the
given styleAttribute. |
static <T> void |
applyNatTableStyle(NatTable natTable,
ConfigAttribute<T> styleConfig,
T value,
String displayMode,
String configLabel)
Apply a style attribute value for the
IStyle registered for
CellConfigAttributes.CELL_STYLE. |
static boolean |
getBoolean(org.w3c.dom.css.CSSValue value,
boolean defaultValue)
Return the
boolean value that represents the given
CSSValue. |
static BorderStyle |
getBorderStyle(org.eclipse.e4.ui.css.core.engine.CSSElementContext context,
String displayMode)
|
static CellEdgeEnum |
getCellEdgeEnum(String value)
Returns the NatTable
CellEdgeEnum for the given string
representation. |
static Object |
getContextValue(org.eclipse.e4.ui.css.core.engine.CSSElementContext context,
String displayMode,
Object key)
Search the value for the given key and
DisplayMode out of the
given CSSElementContext. |
static Object |
getContextValueInherited(org.eclipse.e4.ui.css.core.engine.CSSElementContext context,
org.eclipse.e4.ui.css.core.engine.CSSElementContext natTableContext,
String targetDisplayMode,
Object key)
Search the value for the given key and
DisplayMode out of the
given CSSElementContext. |
static List<String> |
getDecoratorPainter(org.eclipse.e4.ui.css.core.engine.CSSElementContext context,
String displayMode)
Returns the string representation list of cell painter decorators that
should be used to build up the cell painter for rendering.
|
static IDisplayConverter |
getDisplayConverter(String value,
boolean format,
Integer minFractionDigits,
Integer maxFractionDigits,
String datePattern)
Returns the NatTable
IDisplayConverter for the given string
representation. |
static String |
getDisplayConverterString(IDisplayConverter converter) |
static String |
getDisplayMode(String pseudo)
Returns the NatTable
DisplayMode for the given pseudo class. |
static org.eclipse.e4.ui.css.core.dom.properties.css2.CSS2FontProperties |
getFontProperties(org.eclipse.e4.ui.css.core.engine.CSSElementContext context,
String contextKey,
NatTable natTable,
String displayMode,
String label)
Returns the
CSS2FontProperties out of the given
CSSElementContext for the given parameters. |
static <T> T |
getNatTableStyle(NatTable natTable,
ConfigAttribute<T> styleConfig,
String displayMode,
String... configLabels)
Retrieves the style attribute for the given display mode and config
labels out of the NatTable configuration.
|
static Map<String,Object> |
getPainterProperties(org.eclipse.e4.ui.css.core.engine.CSSElementContext context,
String displayMode)
Returns the painter properties out of the given
CSSElementContext
for the given DisplayMode. |
static Map<String,Object> |
getPainterPropertiesInherited(org.eclipse.e4.ui.css.core.engine.CSSElementContext context,
org.eclipse.e4.ui.css.core.engine.CSSElementContext natTableContext,
String targetDisplayMode)
Returns the painter properties out of the given
CSSElementContext
for the given DisplayMode enriched with the painter property
values out of inheritance. |
static boolean |
isConverterString(String value) |
static boolean |
resolvePainter(org.eclipse.e4.ui.css.core.engine.CSSElementContext context,
org.eclipse.e4.ui.css.core.engine.CSSElementContext natTableContext,
String displayMode)
Check if the automatic painter resolution is enabled or disabled via CSS
property.
|
static List<String> |
resolvePainterRepresentation(org.w3c.dom.css.CSSValue value)
Resolves the painter representations out of the given
CSSValue. |
static void |
setFontProperties(org.w3c.dom.css.CSSValueList valueList,
org.eclipse.e4.ui.css.core.dom.properties.css2.CSS2FontProperties font)
Sets the values from the given
CSSValueList to the given
CSS2FontPropertiesCSS2FontProperties. |
static void |
storeBorderStyle(org.w3c.dom.css.CSSValueList valueList,
BorderStyle borderStyle,
org.eclipse.e4.ui.css.core.engine.CSSEngine engine,
org.eclipse.swt.widgets.Display display)
Convert and store the values of the given
CSSValueList to the
given BorderStyle. |
static void |
storeContextValue(org.eclipse.e4.ui.css.core.engine.CSSElementContext context,
String displayMode,
Object key,
Object value)
Put a value for the given key and
DisplayMode to the given
CSSElementContext. |
static void |
storePadding(String paddingKey,
org.w3c.dom.css.CSSValue value,
org.eclipse.e4.ui.css.core.engine.CSSElementContext context,
String displayMode)
Convert and store the padding value for the given key in the painter
properties map.
|
public static boolean getBoolean(org.w3c.dom.css.CSSValue value, boolean defaultValue)
boolean value that represents the given
CSSValue.value - The value for which the boolean value should be returned.defaultValue - The default value to return if the given value can not be
converted to a boolean.public static String getDisplayMode(String pseudo)
DisplayMode for the given pseudo class.pseudo - The pseudo class.DisplayMode value for the given pseudo class.public static CellEdgeEnum getCellEdgeEnum(String value)
CellEdgeEnum for the given string
representation.value - The string representation of the CellEdgeEnumCellEdgeEnum for the string representation.public static IDisplayConverter getDisplayConverter(String value, boolean format, Integer minFractionDigits, Integer maxFractionDigits, String datePattern)
IDisplayConverter for the given string
representation.value - The string representation of the IDisplayConverterformat - flag for number display converters to specify whether
NumberFormat should be used to format or not.minFractionDigits - number of minimum fraction digits to use in case a
NumberFormat is used for formatting a number valuemaxFractionDigits - number of maximum fraction digits to use in case a
NumberFormat is used for formatting a number valuedatePattern - The pattern to use for formatting a date value when a date
display converter requestedIDisplayConverter for the string representation.public static String getDisplayConverterString(IDisplayConverter converter)
converter - The IDisplayConverter for which the String
representation is requested.IDisplayConverter.public static boolean isConverterString(String value)
value - The value to check.true if the given value represents a valid converter
key, false if not.public static <T> T getNatTableStyle(NatTable natTable, ConfigAttribute<T> styleConfig, String displayMode, String... configLabels)
natTable - The NatTable whose ConfigRegistry should be checked
for the style configuration.styleConfig - The style ConfigAttribute that is requested.displayMode - The DisplayMode for which the configuration is
requested.configLabels - The config labels for which the configuration is requested.public static <T> void applyNatTableStyle(NatTable natTable, ConfigAttribute<T> styleConfig, T value, String displayMode, String configLabel)
IStyle registered for
CellConfigAttributes.CELL_STYLE.natTable - The NatTable to apply the style configuration to.styleConfig - The style ConfigAttribute that should be applied.value - The value to apply.displayMode - The DisplayMode for which the configuration should be
applied.configLabel - The label for which the configuration should be applied.public static <T> void applyNatTableStyle(NatTable natTable, ConfigAttribute<IStyle> styleAttribute, ConfigAttribute<T> styleConfig, T value, String displayMode, String configLabel)
IStyle registered for the
given styleAttribute.natTable - The NatTable to apply the style configuration to.styleAttribute - The ConfigAttribute that points to the IStyle
that should be configured.styleConfig - The style ConfigAttribute that should be applied.value - The value to apply.displayMode - The DisplayMode for which the configuration should be
applied.configLabel - The label for which the configuration should be applied.public static org.eclipse.e4.ui.css.core.dom.properties.css2.CSS2FontProperties getFontProperties(org.eclipse.e4.ui.css.core.engine.CSSElementContext context,
String contextKey,
NatTable natTable,
String displayMode,
String label)
CSS2FontProperties out of the given
CSSElementContext for the given parameters. If no
CSS2FontProperties exist, a new instance will be created and
pre-filled with font values based on inheritance.context - The CSSElementContext to search for the context value.contextKey - The context key under which the font properties are stored.natTable - The NatTable instance to apply the styles todisplayMode - The target DisplayMode to check for the value.label - The label for which the font properties are requested.CSS2FontProperties for the given attributes.public static void setFontProperties(org.w3c.dom.css.CSSValueList valueList, org.eclipse.e4.ui.css.core.dom.properties.css2.CSS2FontProperties font)
CSSValueList to the given
CSS2FontPropertiesCSS2FontProperties.valueList - The value list containing the css property valuesfont - The font properties to set the values topublic static BorderStyle getBorderStyle(org.eclipse.e4.ui.css.core.engine.CSSElementContext context, String displayMode)
context - The CSSElementContext to search for the context value.displayMode - The DisplayMode for which the value should be stored.BorderStylepublic static void storeBorderStyle(org.w3c.dom.css.CSSValueList valueList, BorderStyle borderStyle, org.eclipse.e4.ui.css.core.engine.CSSEngine engine, org.eclipse.swt.widgets.Display display) throws Exception
CSSValueList to the
given BorderStyle.valueList - The CSSValueList with the values to convert.borderStyle - The BorderStyle to store the converted values to.engine - The CSSEngine needed for conversion.display - The display needed for color conversion.Exception - if the value conversion failspublic static void storePadding(String paddingKey, org.w3c.dom.css.CSSValue value, org.eclipse.e4.ui.css.core.engine.CSSElementContext context, String displayMode)
paddingKey - The key of the padding property.value - The CSSValue of the padding that should be converted
and stored.context - The CSSElementContext to search for the configuration
value.displayMode - The target DisplayMode to check for the value.public static boolean resolvePainter(org.eclipse.e4.ui.css.core.engine.CSSElementContext context,
org.eclipse.e4.ui.css.core.engine.CSSElementContext natTableContext,
String displayMode)
context - The CSSElementContext to search for the configuration
value.natTableContext - The CSSElementContext of the parent NatTable or
null in case the context parameter is already
from the NatTable itself.displayMode - The target DisplayMode to check for the value.true if the painter to use should be automatically
resolved, false if the painter is configured
elsewhere and therefore no automatic resolution should be
performed. Default is true.public static List<String> getDecoratorPainter(org.eclipse.e4.ui.css.core.engine.CSSElementContext context, String displayMode)
context - The CSSElementContext to search for the context value.displayMode - The DisplayMode for which the value should be stored.public static Map<String,Object> getPainterProperties(org.eclipse.e4.ui.css.core.engine.CSSElementContext context, String displayMode)
CSSElementContext
for the given DisplayMode.context - The CSSElementContext to search for the context value.displayMode - The DisplayMode for which the value should be stored.public static Map<String,Object> getPainterPropertiesInherited(org.eclipse.e4.ui.css.core.engine.CSSElementContext context, org.eclipse.e4.ui.css.core.engine.CSSElementContext natTableContext, String targetDisplayMode)
CSSElementContext
for the given DisplayMode enriched with the painter property
values out of inheritance.context - The CSSElementContext to search for the context value.natTableContext - The CSSElementContext of the parent NatTable or
null in case the context parameter is already
from the NatTable itself.targetDisplayMode - The target DisplayMode to check for the value.public static List<String> resolvePainterRepresentation(org.w3c.dom.css.CSSValue value)
CSSValue.value - The CSSValue to resolve.public static void storeContextValue(org.eclipse.e4.ui.css.core.engine.CSSElementContext context,
String displayMode,
Object key,
Object value)
DisplayMode to the given
CSSElementContext.context - The CSSElementContext to put the value to.displayMode - The DisplayMode for which the value should be stored.key - The key for which the value should be stored.value - The value to store.public static Object getContextValue(org.eclipse.e4.ui.css.core.engine.CSSElementContext context, String displayMode, Object key)
DisplayMode out of the
given CSSElementContext.context - The CSSElementContext out of which the value should be
retrieved.displayMode - The DisplayMode for which the value is requested.key - The key for which the value is requested.DisplayMode and key out of the
given CSSElementContext. If no value is found for the
given DisplayMode, the value out of the given
CSSElementContext directly is returned. Can be
null.public static Object getContextValueInherited(org.eclipse.e4.ui.css.core.engine.CSSElementContext context, org.eclipse.e4.ui.css.core.engine.CSSElementContext natTableContext, String targetDisplayMode, Object key)
DisplayMode out of the
given CSSElementContext. Will search for the value also via
inheritance, that means first it will check the
IDisplayModeOrdering and if there is no value found, it searches
in the parent NatTable context.context - The CSSElementContext to search for the context value.natTableContext - The CSSElementContext of the parent NatTable or
null in case the context parameter is already
from the NatTable itself.targetDisplayMode - The target DisplayMode to check for the value.key - The key of the context value to search for.Copyright © 2019. All rights reserved.