public final class ScriptableUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T,C extends ChartContext> |
getOptionValue(C context,
Scriptable<T,C> callback)
Returns the value of the property as result of callback (the same type).
|
static <T,C extends ChartContext> |
getOptionValue(C context,
Scriptable<T,C> callback,
T defaultValue)
Returns the value of the property as result of callback (the same type), passing a default value.
|
static <C extends ChartContext> |
getOptionValueAsColor(C context,
Scriptable<?,C> callback,
String defaultValue)
Returns a color value of property by a callback, checking all different types of object which can be used as value of the property in color ones.
By defaults, is able to manage also Pattern or CanvasPatternItem . |
static <C extends ChartContext> |
getOptionValueAsColor(C context,
Scriptable<?,C> callback,
String defaultValue,
boolean hasPattern)
Returns a color value of property by a callback, checking all different types of object which can be used as value of the property in color ones.
|
static <C extends ChartContext> |
getOptionValueAsFont(C context,
Scriptable<FontItem,C> callback,
IsDefaultFont defaultValue)
Returns the font item value as value of the property by invoking a callback which is typed to a font item.
|
static <C extends ChartContext> |
getOptionValueAsPadding(C context,
Scriptable<PaddingItem,C> callback,
IsDefaultPadding defaultValue)
Returns the padding item value as value of the property by invoking a callback which is typed to a paddng item.
|
static <T extends Key,C extends ChartContext> |
getOptionValueAsString(C context,
Scriptable<T,C> callback)
Returns the enumeration value as value of the property by invoking a callback which is typed to a key.
|
static <T extends Key,C extends ChartContext> |
getOptionValueAsString(C context,
Scriptable<T,C> callback,
T defaultValue)
Returns the enumeration value of the property by invoking a callback which is typed to a key, passing a default value.
|
static <C extends ChartContext> |
handleCallbackResultAsColor(C context,
Object result,
String defaultValue,
boolean hasPattern)
Returns a color value of property by a callback, checking all different types of object which can be used as value of the property in color ones.
|
static boolean |
isContextConsistent(ChartContext context)
Returns
true if context is consistent, otherwise false . |
static IsChart |
retrieveChart(ChartContext context)
Returns the chart instance, contained in the context if context is consistent.
|
public static boolean isContextConsistent(ChartContext context)
true
if context is consistent, otherwise false
.context
- scriptable contexttrue
if context is consistent, otherwise false
public static IsChart retrieveChart(ChartContext context)
context
- scriptable contextpublic static <C extends ChartContext> PaddingItem getOptionValueAsPadding(C context, Scriptable<PaddingItem,C> callback, IsDefaultPadding defaultValue)
C
- type of context to pass to the callbackcontext
- native object as contextcallback
- padding callback to executedefaultValue
- default padding if the callback returns an inconsistent valuepublic static <C extends ChartContext> FontItem getOptionValueAsFont(C context, Scriptable<FontItem,C> callback, IsDefaultFont defaultValue)
C
- type of context to pass to the callbackcontext
- native object as contextcallback
- font callback to executedefaultValue
- default font if the callback returns an inconsistent valuepublic static <T extends Key,C extends ChartContext> T getOptionValueAsString(C context, Scriptable<T,C> callback)
T
- type of result of the callback which extends a keyC
- type of context to pass to the callbackcontext
- scriptable contextcallback
- callback to invokepublic static <T extends Key,C extends ChartContext> T getOptionValueAsString(C context, Scriptable<T,C> callback, T defaultValue)
T
- type of callback which extends a keyC
- type of context to pass to the callbackcontext
- scriptable contextcallback
- callback to invokedefaultValue
- default value to return in case of chart, callback or result of callback are not consistent.public static <T,C extends ChartContext> T getOptionValue(C context, Scriptable<T,C> callback)
T
- type of callback resultC
- type of context to pass to the callbackcontext
- scriptable contextcallback
- callback to invokepublic static <T,C extends ChartContext> T getOptionValue(C context, Scriptable<T,C> callback, T defaultValue)
T
- type of callback resultC
- type of context to pass to the callbackcontext
- scriptable contextcallback
- callback to invokedefaultValue
- default value to return in case of chart, callback or result of callback are not consistent.public static <C extends ChartContext> Object getOptionValueAsColor(C context, Scriptable<?,C> callback, String defaultValue)
Pattern
or CanvasPatternItem
.C
- type of context to pass to the callbackcontext
- scriptable contextcallback
- callback to invokedefaultValue
- default value to return in case of chart, callback or result of callback are not consistent.public static <C extends ChartContext> Object getOptionValueAsColor(C context, Scriptable<?,C> callback, String defaultValue, boolean hasPattern)
C
- type of context to pass to the callbackcontext
- scriptable contextcallback
- callback to invokedefaultValue
- default value to return in case of chart, callback or result of callback are not consistent.hasPattern
- if true
is able to manage also Pattern
or CanvasPatternItem
, otherwise it skips them.public static <C extends ChartContext> Object handleCallbackResultAsColor(C context, Object result, String defaultValue, boolean hasPattern)
C
- type of context to pass to the callbackcontext
- scriptable contextresult
- result of callback invocationdefaultValue
- default value to return in case of chart, callback or result of callback are not consistent.hasPattern
- if true
is able to manage also Pattern
or CanvasPatternItem
, otherwise it skips them.