At the Diagram level
The default base text direction of the
diagram can be set programmatically by changing the property of
the current instance. For example:
IlvDiagrammer diagrammer = new IlvDiagrammer(); diagrammer.setBaseTextDirection(IlvConstants.RIGHT_TO_LEFT);
The same result can be achieved by adding
the code for the following selector to the CSS file attached to
the Diagram component:
Diagrammer { baseTextDirection : "Right-To-Left" ; }
Or you can set the base text direction property of IlvStyleSheetRenderer. Add the code for the
following selector to the CSS file:
StyleSheet { baseTextDirection : "Right-To-Left" ; }
At the Node level
You can set base text direction for
graphic implementation of a specific node or types of nodes to a
constant value, for example, Right To Left:
node { baseTextDirection : "Right-To-Left" ; }
Alternatively, it can be defined by reference to a property.
Place baseTextDirection style into
the selector that describes such a node or nodes. For example:
node[baseTextDirectionProperty] { baseTextDirection : @baseTextDirectionProperty ; }
Assuming that the property baseTextDirectionProperty
is referenced in CSS (see @baseTextDirectionProperty
in the example) , you can dynamically change base text direction
in the selected node or nodes by using the following Java code:
nodeObj.setObjectProperty(nodeModelObj, "baseTextDirectionProperty", IlvBidiUtil.LEFT_TO_RIGHT)
At the Link level
You can set base text direction for
graphic implementation of a specific link or types of links to a
constant value, for example, Right To Left:
link { baseTextDirection : "Right-To-Left" ; }
Then, it can be defined by reference to a property; Place baseTextDirection style into the selector
that describes such a link or links For example:
link[baseTextDirectionProperty] { baseTextDirection : @baseTextDirectionProperty ; }
Assuming that the property baseTextDirectionProperty
is referenced in CSS (see @baseTextDirectionProperty
in the example) , you can dynamically change base text direction
in the selected link or links by using the following Java code:
link { baseTextDirection : "Right-To-Left" ; }
In the property sheet
You can set base text direction for
specific cells of the property sheet. The definition can be
static by assigning a constant value or dynamic by assigning a
reference to a property. For example, to define base text
direction in the property sheet dynamically:
node:DiagrammerTable:name[baseTextDirectionProperty] { baseTextDirection : "@baseTextDirectionProperty" ; }
If the property sheet can be edited, you
can use a special property editor to edit base text direction.
For example:
node:DiagrammerPropertySheet:baseTextDirection[baseTextDirectionProperty] { propertyEditor : "@#BaseTextDirectionNameEditor" ; } Subobject#BaseTextDirectionNameEditor { class : "ilog.views.util.beans.editor.IlvBaseTextDirectionNameEditor" ; }
In the IlvDiagrammer table
You can set base text direction for a specific cell of an IlvDiagrammerTable object. The definition
can be static by assigning a constant value or dynamic by
assigning a reference to a property. For example, to define base
text direction in the IlvDiagrammerTable
dynamically:
node[baseTextDirectionProperty]:DiagrammerTable:name { baseTextDirection : @baseTextDirectionProperty; }
Base text direction: suitable JViews Diagrammer components
Specifying base text direction for a specific component has the
highest priority. Only when base text direction is defined on a
specific component as DIRECTION_INHERITED
is the value from a higher level used.
Level where base text direction is specified | Additional levels where specification applies | Comments |
---|---|---|
Diagram (IlvDiagrammer) | Nodes, links, property sheet, IlvDiagrammerTable. | Top level |
Node | Text that appears on node. | |
Link | Text that appears on link. | |
Property sheet cells | Text that appears in property sheet cells. | |
IlvDiagrammerTable | Text that appears in IlvDiagrammerTable cells. |
Enabling dynamic change at run time
You can set base text direction dynamically to have the same
value for all text elements of an IlvDiagrammer
object or to assign one specific base text direction value to a
specific text element of the IlvDiagrammer
object.
Dynamically setting a consistent base text direction for all text elements
Setting any of the following values for base text direction
in any JViews
Diagrammer components (node, link, property sheet, table) 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 component 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 IlvDiagrammer object in which the text element is embedded affects the value of the base text direction of text elements in the IlvDiagrammer instance.
- Component Orientation
-
For example, change of GUI direction for the container in which the diagram is embedded affects the base text direction of text elements in the diagram.
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 IlvDiagrammer
object.
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 objects in the IlvDiagrammer object.
- The API is used to change the value of base text direction at the highest level of graphic object; for example, diagrammerObj.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 of the IlvDiagrammer
object by using the Designer. See Assigning one specific value
to a specific text element of an IlvDiagrammer
object.
Then, you can implement the setting
dynamically at run time by the following code:
designerObj.setObjectProperty(linkObj, "myBaseTextDirection", IlvBidiUtil.RIGHT_TO_LEFT)
where:
- linkObj
-
An instance of the link that contains the Text element.
- “myBaseTextDirection”
-
Name of the parameter added to the link object and identified in the expression that is referenced by the baseTextDirection property; in this example, myBaseTextDirection.
- IlvBidiUtil.RIGHT_TO_LEFT
-
One of the valid values of base text direction.