Package org.eclipse.birt.chart.factory

# Class RunTimeContext

java.lang.Object
org.eclipse.birt.chart.factory.RunTimeContext

All Implemented Interfaces:
  `Serializable`

public final class RunTimeContext extends Object implements Serializable
Encapsulates 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 class`
`RunTimeContext.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

Modifier and Type
Method
Description
`void`
`clearState()`
Clears all the stored states.
`void`
`enableNonHierarchyCategoryData(boolean enabled)`
`String`
`externalizedMessage(String sChartKey)`
A convenience method provided to lookup externalized messages associated with a given message key.
`IActionRenderer`
`getActionRenderer()`
Returns the IActionRenderer of current runtime context.
`Chart`
`getDefaultValueChart()`
Returns instance of default value chart.
`IExternalizer`
`getExternalizer()`
`LegendLayoutHints`
`getLegendLayoutHints()`
Returns the LegendItemLayoutHints for current context.
`Locale`
`getLocale()`
Deprecated.
use `getULocale()` instead.
`IResourceFinder`
`getResourceFinder()`
`org.eclipse.birt.core.i18n.ResourceHandle`
`getResourceHandle()`
Returns an instance of the resource handle for which chart specific messages are externalized.
`IScriptClassLoader`
`getScriptClassLoader()`
Returns the script classLoader if available.
`IScriptContext`
`getScriptContext()`
Returns an instance of a script context associated with the chart being generated.
`AbstractScriptHandler`
`getScriptHandler()`
Returns an instance of a transient script handler associated with the chart being generated.
`Map<Series,LegendItemRenderingHints>`
`getSeriesRenderers()`
Returns the series renderers for current context.
`SharedScaleContext`
`getSharedScale()`
Returns the shared scale
`Object`
`getState(Object key)`
Returns the state object from store by the key.
`<T> T`
`getState(RunTimeContext.StateKey<T> key)`
`IStructureDefinitionListener`
`getStructureDefinitionListener()`
Returns an instance of the structure definition listner for device renderers that need a structure definition notification when rendering primitives.
`com.ibm.icu.util.TimeZone`
`getTimeZone()`
`com.ibm.icu.util.ULocale`
`getULocale()`
Returns the locale associated with this runtime context.
`boolean`
`isRightToLeft()`
Returns if current context is in a right-left platform.
`boolean`
`isRightToLeftText()`
Returns true if current text reading order is Right To Left
`boolean`
`isScriptingEnabled()`
Returns if scriting is enabled in current context.
`boolean`
`isSharingQuery()`
`boolean`
`notifyStructureChange(String sEventName, 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.
`void`
`putState(Object key, Object state)`
Puts a state object to the store.
`<T> void`
`putState(RunTimeContext.StateKey<T> key, T value)`
`Object`
`removeState(Object key)`
Removes the state object by the key.
`void`
`setActionRenderer(IActionRenderer iar)`
Sets an IActionRenderer instance to current runtime context.
`void`
`setDefaultValueChart(Chart cm)`
Sets instance of default value chart.
`void`
`setExternalizer(IExternalizer externalizer)`
`void`
`setLegendLayoutHints(LegendLayoutHints lilh)`
Sets the LegendItemLayoutHints for current context.
`void`
`setLocale(Locale lcl)`
Deprecated.
use `setULocale(ULocale)` instead.
`void`
`setMessageLookup(IMessageLookup iml)`
Defines an externalized message lookup implementation per chart model being executed.
`void`
`setResourceFinder(IResourceFinder resourceFinder)`
`void`
`setResourceHandle(org.eclipse.birt.core.i18n.ResourceHandle rh)`
Specifies a resource handle that facilitates retrieval of chart specific externalized messages.
`void`
`setRightToLeft(boolean value)`
Sets the right-left mode for current context mandatorily.
`void`
`setRightToLeftText(boolean value)`
Sets the bidi text mode of the current chart object .
`void`
`setScriptClassLoader(IScriptClassLoader value)`
Sets the script classLoader.
`void`
`setScriptContext(IScriptContext csc)`
Sets an instance of a chart script context associated with the chart being generated.
`void`
`setScriptHandler(AbstractScriptHandler sh)`
Sets an instance of a transient script handler associated with the chart being generated.
`void`
`setScriptingEnabled(boolean value)`
Sepcifies if to enable scripting in current context.
`void`
`setSeriesRenderers(Map<Series,LegendItemRenderingHints> msr)`
Sets the series renderers for current context.
`void`
`setSharedScale(SharedScaleContext ssContext)`
Sets the shared scale
`void`
`setSharingQuery(boolean isSharingQuery)`
`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.
`void`
`setTimeZone(com.ibm.icu.util.TimeZone timeZone)`
`void`
`setULocale(com.ibm.icu.util.ULocale lcl)`
Sets the locale associated with this runtime context.
`boolean`
`useNonHierarchyCategoryData()`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### RunTimeContext

public RunTimeContext()
A default zero-arg public constructor used for object creation.

## Method Details

### putState

public void putState(Object key, Object state)
Puts a state object to the store.

Parameters:
  `key` -
  `state` -

### getState

public Object getState(Object key)
Returns the state object from store by the key.

Parameters:
  `key` -
Returns:

### removeState

public Object removeState(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(Map<Series,LegendItemRenderingHints> msr)
Sets the series renderers for current context.

Parameters:
  `msr` -

### getSeriesRenderers

public Map<Series,LegendItemRenderingHints> getSeriesRenderers()
Returns the series renderers for current context.

Returns:

### notifyStructureChange

public boolean notifyStructureChange(String sEventName, 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 type
  `oSource` - 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 Locale getLocale()
Deprecated.
use `getULocale()` instead.
Returns the locale associated with this runtime context.

Returns:
  The locale associated with this runtime context.

### setLocale

@Deprecated public void setLocale(Locale lcl)
Deprecated.
use `setULocale(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 String externalizedMessage(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()