Base text direction
Explains how to handle base text direction in a dashboard programmatically.
Lists the text elements to which base text direction can be applied.
Describes how to handle base text direction programmatically at three different levels: the dashboard level, the background text elements level, and the symbol level.
You can set base text direction dynamically to apply the same value for all text elements of the dashboard or to assign one specific base text direction value to a specific text element of the dashboard.
Elements eligible for base text direction
Base text direction is applicable to all text-related objects that are displayed in the dashboard, including:
Text elements directly placed on the dashboard background
Text elements that are part of symbols placed on the dashboard
Specifying base text direction for a specific level has the highest priority. Only when base text direction is defined on a specific level as DIRECTION_INHERITED is the value from a higher level used.
Level where base text direction is specified | Additional levels where specification applies | Comments |
Dashboard | Symbols, background text elements | Top level |
Background text element | Label of this text element | |
Symbol added to the dashboard | All text elements included in the symbol | |
Text element of symbol added to the dashboard | Label of this text element | |
Setting base text direction programmatically
At the dashboard level
You can set the default base text direction for the entire dashboard programmatically in the following way:
IlvDashboardDiagram dashboardObj = new IlvDashboardDiagram(context);
...
dashboardObj.setBaseTextDirection(IlvBidiUtil.LEFT_TO_RIGHT);
At the background text elements level
You can set a specific base text direction for any text element that is added directly on the dashboard background by using standard Java framework code. For example:
textObj.setBaseTextDirection(IlvBidiUtil.LEFT_TO_RIGHT);
At the symbol level
You can change the base text direction of a symbol programmatically if and only if its baseTextDirection property is mapped to the baseTextDirection style of the symbol’s top-level graphic element, as shown in the following figure:
Setting base text direction programmatically at the symbol level
If this is the case, then you can use the following code:
dashboardObj.setObjectProperty(symbolObj, "baseTextDirection", "Right-To-Left");
Enabling dynamic change at run time
Dynamically setting a consistent base text direction for all text elements
Setting any of the following base text direction values to elements of a dashboard (for example, text element directly placed on the dashboard background, text element of a symbol placed in the dashboard) is an explicit or static assignment:
Left To Right
Right To Left
Contextual
The only external factor that can affect these settings on a given element is a call to the Java API.
Setting base text direction to one of the following values means that base text direction can be affected by external influences at run time:
Inherited
For example, change of the base specification in the dashboard in which the text element is embedded affects the value of the base text direction of text elements in the dashboard.
Component Orientation
For example, change of GUI direction for the container in which the dashboard is embedded affects the base text direction of text elements in the dashboard.
By such a change at run time, you can dynamically affect the base text direction in a consistent way for all text elements contained in the dashboard.
For such a dynamic run time change, the following conditions must be satisfied:
No explicit value is assigned to the base text direction property of any object in the dashboard.
The API is used to change the value of base text direction at the highest level of graphic object; for example,
dashboardObj.setBaseTextDirection(IlvBidiUtil.RIGHT_TO_LEFT);
Dynamically assigning one specific base text direction value to a specific text element
You can dynamically assign one specific base text direction value to a specific text element directly added to the dashboard by using standard Java framework API (for example, setBaseTextDirection):
textObj.setBaseTextDirection(IlvBidiUtil.LEFT_TO_RIGHT);
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.