Package org.eclipse.birt.chart.factory
Class RunTimeContext
- java.lang.Object
-
- org.eclipse.birt.chart.factory.RunTimeContext
-
- All Implemented Interfaces:
java.io.Serializable
public final class RunTimeContext extends java.lang.Object implements java.io.SerializableEncapsulates runtime information associated with each chart generation and rendering session. It contains global objects that are defined per request.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRunTimeContext.StateKey<T>Predifined static keys for states.
-
Constructor Summary
Constructors Constructor Description RunTimeContext()A default zero-arg public constructor used for object creation.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclearState()Clears all the stored states.voidenableNonHierarchyCategoryData(boolean enabled)java.lang.StringexternalizedMessage(java.lang.String sChartKey)A convenience method provided to lookup externalized messages associated with a given message key.IActionRenderergetActionRenderer()Returns the IActionRenderer of current runtime context.ChartgetDefaultValueChart()Returns instance of default value chart.IExternalizergetExternalizer()LegendLayoutHintsgetLegendLayoutHints()Returns the LegendItemLayoutHints for current context.java.util.LocalegetLocale()Deprecated.usegetULocale()instead.IResourceFindergetResourceFinder()org.eclipse.birt.core.i18n.ResourceHandlegetResourceHandle()Returns an instance of the resource handle for which chart specific messages are externalized.IScriptClassLoadergetScriptClassLoader()Returns the script classLoader if available.IScriptContextgetScriptContext()Returns an instance of a script context associated with the chart being generated.AbstractScriptHandlergetScriptHandler()Returns an instance of a transient script handler associated with the chart being generated.java.util.Map<Series,LegendItemRenderingHints>getSeriesRenderers()Returns the series renderers for current context.SharedScaleContextgetSharedScale()Returns the shared scalejava.lang.ObjectgetState(java.lang.Object key)Returns the state object from store by the key.<T> TgetState(RunTimeContext.StateKey<T> key)IStructureDefinitionListenergetStructureDefinitionListener()Returns an instance of the structure definition listner for device renderers that need a structure definition notification when rendering primitives.com.ibm.icu.util.TimeZonegetTimeZone()com.ibm.icu.util.ULocalegetULocale()Returns the locale associated with this runtime context.booleanisRightToLeft()Returns if current context is in a right-left platform.booleanisRightToLeftText()Returns true if current text reading order is Right To LeftbooleanisScriptingEnabled()Returns if scriting is enabled in current context.booleanisSharingQuery()booleannotifyStructureChange(java.lang.String sEventName, java.lang.Object oSource)Notifies the structure definition listener of a change in the current running structure that defines a group of primitives being rendered and puts them into context with reference to the source object.voidputState(java.lang.Object key, java.lang.Object state)Puts a state object to the store.<T> voidputState(RunTimeContext.StateKey<T> key, T value)java.lang.ObjectremoveState(java.lang.Object key)Removes the state object by the key.voidsetActionRenderer(IActionRenderer iar)Sets an IActionRenderer instance to current runtime context.voidsetDefaultValueChart(Chart cm)Sets instance of default value chart.voidsetExternalizer(IExternalizer externalizer)voidsetLegendLayoutHints(LegendLayoutHints lilh)Sets the LegendItemLayoutHints for current context.voidsetLocale(java.util.Locale lcl)Deprecated.usesetULocale(ULocale)instead.voidsetMessageLookup(IMessageLookup iml)Defines an externalized message lookup implementation per chart model being executed.voidsetResourceFinder(IResourceFinder resourceFinder)voidsetResourceHandle(org.eclipse.birt.core.i18n.ResourceHandle rh)Specifies a resource handle that facilitates retrieval of chart specific externalized messages.voidsetRightToLeft(boolean value)Sets the right-left mode for current context mandatorily.voidsetRightToLeftText(boolean value)Sets the bidi text mode of the current chart object .voidsetScriptClassLoader(IScriptClassLoader value)Sets the script classLoader.voidsetScriptContext(IScriptContext csc)Sets an instance of a chart script context associated with the chart being generated.voidsetScriptHandler(AbstractScriptHandler sh)Sets an instance of a transient script handler associated with the chart being generated.voidsetScriptingEnabled(boolean value)Sepcifies if to enable scripting in current context.voidsetSeriesRenderers(java.util.Map<Series,LegendItemRenderingHints> msr)Sets the series renderers for current context.voidsetSharedScale(SharedScaleContext ssContext)Sets the shared scalevoidsetSharingQuery(boolean isSharingQuery)voidsetStructureDefinitionListener(IStructureDefinitionListener isdl)Internally sets an instance of the structure definition listener for device renderers that need a structure definition notification when rendering primitives.voidsetTimeZone(com.ibm.icu.util.TimeZone timeZone)voidsetULocale(com.ibm.icu.util.ULocale lcl)Sets the locale associated with this runtime context.booleanuseNonHierarchyCategoryData()
-
-
-
Method Detail
-
putState
public void putState(java.lang.Object key, java.lang.Object state)Puts a state object to the store.- Parameters:
key-state-
-
getState
public java.lang.Object getState(java.lang.Object key)
Returns the state object from store by the key.- Parameters:
key-- Returns:
-
removeState
public java.lang.Object removeState(java.lang.Object key)
Removes the state object by the key.- Parameters:
key-- Returns:
-
clearState
public void clearState()
Clears all the stored states.
-
isScriptingEnabled
public boolean isScriptingEnabled()
Returns if scriting is enabled in current context.- Returns:
-
setScriptingEnabled
public void setScriptingEnabled(boolean value)
Sepcifies if to enable scripting in current context.- Parameters:
value-
-
getScriptClassLoader
public IScriptClassLoader getScriptClassLoader()
Returns the script classLoader if available.- Returns:
-
setScriptClassLoader
public void setScriptClassLoader(IScriptClassLoader value)
Sets the script classLoader.- Parameters:
value-
-
setStructureDefinitionListener
public void setStructureDefinitionListener(IStructureDefinitionListener isdl)
Internally sets an instance of the structure definition listener for device renderers that need a structure definition notification when rendering primitives.- Parameters:
isdl- The structure definition listener associated with the runtime context.
-
getStructureDefinitionListener
public IStructureDefinitionListener getStructureDefinitionListener()
Returns an instance of the structure definition listner for device renderers that need a structure definition notification when rendering primitives.- Returns:
- The structure definition listener associated with the runtime context.
-
setActionRenderer
public void setActionRenderer(IActionRenderer iar)
Sets an IActionRenderer instance to current runtime context.- Parameters:
iar-
-
getActionRenderer
public IActionRenderer getActionRenderer()
Returns the IActionRenderer of current runtime context.- Returns:
-
setLegendLayoutHints
public void setLegendLayoutHints(LegendLayoutHints lilh)
Sets the LegendItemLayoutHints for current context.- Parameters:
lilh-
-
getLegendLayoutHints
public LegendLayoutHints getLegendLayoutHints()
Returns the LegendItemLayoutHints for current context.- Returns:
-
setSeriesRenderers
public void setSeriesRenderers(java.util.Map<Series,LegendItemRenderingHints> msr)
Sets the series renderers for current context.- Parameters:
msr-
-
getSeriesRenderers
public java.util.Map<Series,LegendItemRenderingHints> getSeriesRenderers()
Returns the series renderers for current context.- Returns:
-
notifyStructureChange
public boolean notifyStructureChange(java.lang.String sEventName, java.lang.Object oSource)Notifies the structure definition listener of a change in the current running structure that defines a group of primitives being rendered and puts them into context with reference to the source object.- Parameters:
sEventName- Defines the structure being defined along with the event typeoSource- The source object on which the structure is being defined- Returns:
- 'true' if the structure definition listener exists and was notified of the change or 'false' otherwise.
-
getLocale
@Deprecated public java.util.Locale getLocale()
Deprecated.usegetULocale()instead.Returns the locale associated with this runtime context.- Returns:
- The locale associated with this runtime context.
-
setLocale
@Deprecated public void setLocale(java.util.Locale lcl)
Deprecated.usesetULocale(ULocale)instead.Sets the locale associated with this runtime context. This is usually done when chart generation begins.- Parameters:
lcl- The locale associated with the runtime context.
-
getULocale
public com.ibm.icu.util.ULocale getULocale()
Returns the locale associated with this runtime context.- Returns:
- The locale associated with this runtime context.
- Since:
- 2.1
-
setULocale
public void setULocale(com.ibm.icu.util.ULocale lcl)
Sets the locale associated with this runtime context. This is usually done when chart generation begins.- Parameters:
lcl- The locale associated with the runtime context.- Since:
- 2.1
-
isRightToLeft
public boolean isRightToLeft()
Returns if current context is in a right-left platform. e.g. Arabic, Hebrew.- Returns:
-
setRightToLeft
public void setRightToLeft(boolean value)
Sets the right-left mode for current context mandatorily.- Parameters:
value-
-
getResourceHandle
public org.eclipse.birt.core.i18n.ResourceHandle getResourceHandle()
Returns an instance of the resource handle for which chart specific messages are externalized.- Returns:
- An instance of the resource handle for which chart specific messages are externalized.
-
setResourceHandle
public void setResourceHandle(org.eclipse.birt.core.i18n.ResourceHandle rh)
Specifies a resource handle that facilitates retrieval of chart specific externalized messages.- Parameters:
rh- The resource handle.
-
getScriptHandler
public AbstractScriptHandler getScriptHandler()
Returns an instance of a transient script handler associated with the chart being generated. The script handler is capable of executing callback scripts defined in the chart model.- Returns:
- An instance of the script handler.
-
setScriptHandler
public void setScriptHandler(AbstractScriptHandler sh)
Sets an instance of a transient script handler associated with the chart being generated. The script handler is capable of executing callback scripts defined in the chart model.- Parameters:
sh- An instance of the script handler.
-
getScriptContext
public IScriptContext getScriptContext()
Returns an instance of a script context associated with the chart being generated.- Returns:
- An instance of the script context.
-
setScriptContext
public void setScriptContext(IScriptContext csc)
Sets an instance of a chart script context associated with the chart being generated.- Parameters:
csc- An instance of the chart script context.
-
setMessageLookup
public void setMessageLookup(IMessageLookup iml)
Defines an externalized message lookup implementation per chart model being executed.- Parameters:
iml- The externalized message lookup implementation.
-
externalizedMessage
public java.lang.String externalizedMessage(java.lang.String sChartKey)
A convenience method provided to lookup externalized messages associated with a given message key.- Parameters:
sChartKey- The key using which an externalized message is being looked up.- Returns:
- The externalized message associated with the specified key.
-
setSharedScale
public void setSharedScale(SharedScaleContext ssContext)
Sets the shared scale- Parameters:
scale- shared scale context- Since:
- 2.5
-
getSharedScale
public SharedScaleContext getSharedScale()
Returns the shared scale- Returns:
- the shared scale context
- Since:
- 2.5
-
isSharingQuery
public boolean isSharingQuery()
-
setSharingQuery
public void setSharingQuery(boolean isSharingQuery)
-
isRightToLeftText
public boolean isRightToLeftText()
Returns true if current text reading order is Right To Left- Returns:
-
setRightToLeftText
public void setRightToLeftText(boolean value)
Sets the bidi text mode of the current chart object .- Parameters:
value-
-
getResourceFinder
public IResourceFinder getResourceFinder()
- Returns:
- Returns the resourceFinder.
-
setResourceFinder
public void setResourceFinder(IResourceFinder resourceFinder)
- Parameters:
resourceFinder- The resourceFinder to set.
-
getExternalizer
public IExternalizer getExternalizer()
- Returns:
- Returns the externalizer.
-
setExternalizer
public void setExternalizer(IExternalizer externalizer)
- Parameters:
externalizer- The externalizer to set.
-
getState
public <T> T getState(RunTimeContext.StateKey<T> key)
-
putState
public <T> void putState(RunTimeContext.StateKey<T> key, T value)
-
setDefaultValueChart
public void setDefaultValueChart(Chart cm)
Sets instance of default value chart.- Parameters:
cm-
-
getDefaultValueChart
public Chart getDefaultValueChart()
Returns instance of default value chart.- Returns:
- instance of default value chart.
-
getTimeZone
public com.ibm.icu.util.TimeZone getTimeZone()
- Returns:
- Returns the timeZone.
-
setTimeZone
public void setTimeZone(com.ibm.icu.util.TimeZone timeZone)
- Parameters:
timeZone- The timeZone to set.
-
enableNonHierarchyCategoryData
public void enableNonHierarchyCategoryData(boolean enabled)
-
useNonHierarchyCategoryData
public boolean useNonHierarchyCategoryData()
-
-