Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 225540 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/birt/chart/factory/RunTimeContext.java (-2 / +5 lines)
Lines 374-383 Link Here
374
	 */
374
	 */
375
	public boolean isRightToLeft( )
375
	public boolean isRightToLeft( )
376
	{
376
	{
377
		if ( iRightToLeft == -1 )
377
		// Report direction does no longer depend on Locale, and so the code below is commented out.
378
		//bidi_acgc deleted start
379
		/*if ( iRightToLeft == -1 )
378
		{
380
		{
379
			iRightToLeft = ChartUtil.isRightToLeftLocale( lcl ) ? 1 : 0;
381
			iRightToLeft = ChartUtil.isRightToLeftLocale( lcl ) ? 1 : 0;
380
		}
382
		}*/
383
		//bidi_acgc deleted end
381
		return iRightToLeft == 1;
384
		return iRightToLeft == 1;
382
	}
385
	}
383
386
(-)src/org/eclipse/birt/chart/factory/Generator.java (+10 lines)
Lines 655-660 Link Here
655
655
656
		// Update the context with a locale if it is undefined.
656
		// Update the context with a locale if it is undefined.
657
		final Chart cmRunTime = (Chart) EcoreUtil.copy( model );
657
		final Chart cmRunTime = (Chart) EcoreUtil.copy( model );
658
		//bidi_acgc added start // Workaround because EcoreUtil.copy method is not aware of the direction property of charts
659
		if (model != null)
660
			cmRunTime.setDirection(model.getDirection());
661
		//bidi_acgc added end
658
		rtc.setULocale( locale != null ? locale : ULocale.getDefault( ) );
662
		rtc.setULocale( locale != null ? locale : ULocale.getDefault( ) );
659
663
660
		ChartScriptContext csc = new ChartScriptContext( );
664
		ChartScriptContext csc = new ChartScriptContext( );
Lines 891-896 Link Here
891
			// re-init chart script context.
895
			// re-init chart script context.
892
			ChartScriptContext csc = new ChartScriptContext( );
896
			ChartScriptContext csc = new ChartScriptContext( );
893
			Chart cmRunTime = (Chart) EcoreUtil.copy( cmDesignTime );
897
			Chart cmRunTime = (Chart) EcoreUtil.copy( cmDesignTime );
898
			//bidi_acgc added start 
899
			//Make the model aware of the direction property updates
900
			Chart tempChart = ((Chart) EcoreUtil.copy( cmDesignTime ));
901
			if (cmDesignTime != null)
902
				cmRunTime.setDirection(cmDesignTime.getDirection());
903
			//bidi_acgc added end
894
			ChartUtil.pruneInvisibleSeries( cmRunTime );
904
			ChartUtil.pruneInvisibleSeries( cmRunTime );
895
			csc.setChartInstance( cmRunTime );
905
			csc.setChartInstance( cmRunTime );
896
			csc.setExternalContext( externalContext );
906
			csc.setExternalContext( externalContext );
(-)src/org/eclipse/birt/chart/event/TextRenderEvent.java (-1 / +19 lines)
Lines 21-26 Link Here
21
import org.eclipse.birt.chart.model.attribute.impl.BoundsImpl;
21
import org.eclipse.birt.chart.model.attribute.impl.BoundsImpl;
22
import org.eclipse.birt.chart.model.attribute.impl.LocationImpl;
22
import org.eclipse.birt.chart.model.attribute.impl.LocationImpl;
23
import org.eclipse.birt.chart.model.attribute.impl.TextAlignmentImpl;
23
import org.eclipse.birt.chart.model.attribute.impl.TextAlignmentImpl;
24
import org.eclipse.birt.chart.model.attribute.Text;// bidi_acgc added
24
import org.eclipse.birt.chart.model.component.Label;
25
import org.eclipse.birt.chart.model.component.Label;
25
import org.eclipse.birt.chart.model.component.impl.LabelImpl;
26
import org.eclipse.birt.chart.model.component.impl.LabelImpl;
26
import org.eclipse.birt.chart.model.layout.LabelBlock;
27
import org.eclipse.birt.chart.model.layout.LabelBlock;
Lines 119-125 Link Here
119
	{
120
	{
120
		_boBlock = boBlock;
121
		_boBlock = boBlock;
121
	}
122
	}
122
123
	//bidi_acgc added start
124
	/**
125
	 * Adds the "RLE" and "PDF" unicode control characters to label caption where "RLE" is added to the beginning  and "PDF" to the end 
126
	 * to apply right to left reading order
127
	 */
128
	public final void setRtlCaption()
129
	{
130
		Label lbl = this.getLabel();
131
		if (lbl != null)
132
		{
133
			Text txt = lbl.getCaption();
134
			String val = txt.getValue();
135
			if (val.length() > 0)
136
				if ('\u202b' != val.charAt(0))
137
					txt.setValue( '\u202b' + val + '\u202c');
138
		}
139
	}
140
	//bidi_acgc added end
123
	/**
141
	/**
124
	 * @return Returns the block bounds of the text.
142
	 * @return Returns the block bounds of the text.
125
	 */
143
	 */
(-)src/org/eclipse/birt/chart/render/BaseRenderer.java (-1 / +20 lines)
Lines 1521-1526 Link Here
1521
				tre.setBlockAlignment( ta );
1521
				tre.setBlockAlignment( ta );
1522
				tre.setLabel( lgTitle );
1522
				tre.setLabel( lgTitle );
1523
				tre.setAction( TextRenderEvent.RENDER_TEXT_IN_BLOCK );
1523
				tre.setAction( TextRenderEvent.RENDER_TEXT_IN_BLOCK );
1524
				//bidi_acgc added start
1525
				if (cm.isRtlDirection())
1526
					tre.setRtlCaption();
1527
				//bidi_acgc added end
1524
				ipr.drawText( tre );
1528
				ipr.drawText( tre );
1525
			}
1529
			}
1526
		}
1530
		}
Lines 1743-1748 Link Here
1743
		{
1747
		{
1744
			tre.setLabel( la );
1748
			tre.setLabel( la );
1745
			tre.setAction( TextRenderEvent.RENDER_TEXT_AT_LOCATION );
1749
			tre.setAction( TextRenderEvent.RENDER_TEXT_AT_LOCATION );
1750
			//bidi_acgc added start
1751
			if (cm.isRtlDirection())
1752
				tre.setRtlCaption();
1753
			//bidi_acgc added end
1746
			ipr.drawText( tre );
1754
			ipr.drawText( tre );
1747
		}
1755
		}
1748
1756
Lines 1762-1767 Link Here
1762
					+ 1, dValueWidth - 2, dExtraHeight - 1 ) );
1770
					+ 1, dValueWidth - 2, dExtraHeight - 1 ) );
1763
			tre.setLabel( tmpLa );
1771
			tre.setLabel( tmpLa );
1764
			tre.setAction( TextRenderEvent.RENDER_TEXT_IN_BLOCK );
1772
			tre.setAction( TextRenderEvent.RENDER_TEXT_IN_BLOCK );
1773
			//bidi_acgc added start
1774
			if (cm.isRtlDirection())
1775
				tre.setRtlCaption();
1776
			//bidi_acgc added end
1765
			ipr.drawText( tre );
1777
			ipr.drawText( tre );
1766
		}
1778
		}
1767
1779
Lines 2136-2146 Link Here
2136
		final LabelBlock lb = (LabelBlock) b;
2148
		final LabelBlock lb = (LabelBlock) b;
2137
		final TextRenderEvent tre = (TextRenderEvent) ( (EventObjectCache) ipr ).getEventObject( oSource,
2149
		final TextRenderEvent tre = (TextRenderEvent) ( (EventObjectCache) ipr ).getEventObject( oSource,
2138
				TextRenderEvent.class );
2150
				TextRenderEvent.class );
2139
2151
		//bidi_acgc added start
2152
		if (cm.isRtlDirection())
2153
			tre.setRtlCaption();
2154
		//bidi_acgc added end
2140
		// need backup original non-externalized value.
2155
		// need backup original non-externalized value.
2141
		final String sRestoreValue = tre.updateFrom( lb, dScale, rtc );
2156
		final String sRestoreValue = tre.updateFrom( lb, dScale, rtc );
2142
		if ( lb.getLabel( ).isVisible( ) )
2157
		if ( lb.getLabel( ).isVisible( ) )
2143
		{
2158
		{
2159
			//bidi_acgc added start
2160
			if (cm.isRtlDirection())
2161
				tre.setRtlCaption();
2162
			//bidi_acgc added end
2144
			ipr.drawText( tre );
2163
			ipr.drawText( tre );
2145
		}
2164
		}
2146
		lb.getLabel( ).getCaption( ).setValue( sRestoreValue );
2165
		lb.getLabel( ).getCaption( ).setValue( sRestoreValue );
(-)src/org/eclipse/birt/chart/render/AxesRenderHelper.java (+16 lines)
Lines 809-814 Link Here
809
								tre.setTextPosition( iLabelLocation );
809
								tre.setTextPosition( iLabelLocation );
810
							}
810
							}
811
						}
811
						}
812
						//bidi_acgc added start
813
						if(this.renderer.cm.isRtlDirection())	
814
							tre.setRtlCaption();							
815
						//bidi_acgc added end
812
						ipr.drawText( tre );
816
						ipr.drawText( tre );
813
					}
817
					}
814
				}
818
				}
Lines 1017-1022 Link Here
1017
								tre.setTextPosition( iLabelLocation );
1021
								tre.setTextPosition( iLabelLocation );
1018
							}
1022
							}
1019
						}
1023
						}
1024
						//bidi_acgc added start
1025
						if(this.renderer.cm.isRtlDirection())	
1026
							tre.setRtlCaption();
1027
						//bidi_acgc added end
1020
						ipr.drawText( tre );
1028
						ipr.drawText( tre );
1021
					}
1029
					}
1022
				}
1030
				}
Lines 1621-1626 Link Here
1621
						tre.setAction( TextRenderEvent.RENDER_TEXT_IN_BLOCK );
1629
						tre.setAction( TextRenderEvent.RENDER_TEXT_IN_BLOCK );
1622
						if ( ax.getTitle( ).isVisible( ) )
1630
						if ( ax.getTitle( ).isVisible( ) )
1623
						{
1631
						{
1632
							//bidi_acgc added start
1633
							if(this.renderer.cm.isRtlDirection())	
1634
								tre.setRtlCaption();
1635
							//bidi_acgc added end
1624
							ipr.drawText( tre );
1636
							ipr.drawText( tre );
1625
						}
1637
						}
1626
					}
1638
					}
Lines 2058-2063 Link Here
2058
									.getAlignment( ) ) );
2070
									.getAlignment( ) ) );
2059
						}
2071
						}
2060
						tre.setAction( TextRenderEvent.RENDER_TEXT_IN_BLOCK );
2072
						tre.setAction( TextRenderEvent.RENDER_TEXT_IN_BLOCK );
2073
						//bidi_acgc added start
2074
						if(this.renderer.cm.isRtlDirection())	
2075
							tre.setRtlCaption();
2076
						//bidi_acgc added end
2061
						ipr.drawText( tre );
2077
						ipr.drawText( tre );
2062
					}
2078
					}
2063
				}
2079
				}
(-)src/org/eclipse/birt/chart/model/Chart.java (+18 lines)
Lines 139-145 Link Here
139
	 * @generated
139
	 * @generated
140
	 */
140
	 */
141
	void setType( String value );
141
	void setType( String value );
142
	//bidi_acgc added start
143
	 /* The code below is not generated. */
144
	 
145
	/**
146
	 * Returns the value of chart Direction<!-- begin-user-doc --> Gets the direction of this
147
	 * chart. <!-- end-user-doc --> <!-- begin-model-doc -->
148
	 */
149
	String getDirection( );
150
	/**
151
	 * begin-user-doc --> Sets the direction of this chart.
152
	 * <!-- end-user-doc -->
153
	 * 
154
	 */
155
	
156
	void setDirection(String value );
157
	
158
	boolean isRtlDirection();
142
159
160
	//bidi_acgc added end
143
	/**
161
	/**
144
	 * Returns the value of the '<em><b>Sub Type</b></em>' attribute. <!-- begin-user-doc --> Gets the sub-type of
162
	 * Returns the value of the '<em><b>Sub Type</b></em>' attribute. <!-- begin-user-doc --> Gets the sub-type of
145
	 * this chart. <!-- end-user-doc --> <!-- begin-model-doc -->
163
	 * this chart. <!-- end-user-doc --> <!-- begin-model-doc -->
(-)src/org/eclipse/birt/chart/model/impl/ChartImpl.java (+41 lines)
Lines 124-131 Link Here
124
	 * @ordered
124
	 * @ordered
125
	 */
125
	 */
126
	protected boolean versionESet = false;
126
	protected boolean versionESet = false;
127
//bidi_acgc added start
128
	
129
	protected static final String DIRECTION_EDEFAULT = "ltr"; //$NON-NLS-1$
127
130
128
	/**
131
	/**
132
	 * The code below is not generated from chart emf model
133
	 */
134
	protected String direction = DIRECTION_EDEFAULT;
135
	//bidi_acgc added end
136
	/**
129
	 * The default value of the '{@link #getType() <em>Type</em>}' attribute.
137
	 * The default value of the '{@link #getType() <em>Type</em>}' attribute.
130
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
138
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
131
	 * @see #getType()
139
	 * @see #getType()
Lines 418-424 Link Here
418
	{
426
	{
419
		return type;
427
		return type;
420
	}
428
	}
429
	//bidi_acgc added start
430
	/**
431
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
432
	 * Gets chart bidi text direction
433
	 * @author BIDI ACGC
434
	 */
435
	
436
	public String getDirection( )
437
	{
438
		return direction;
439
	}
440
	/**
441
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
442
	 * Sets chart bidi text direction
443
	 * @author BIDI ACGC
444
	 */
445
	public void setDirection( String newDirection)
446
	{
421
447
448
		direction = newDirection;
449
	}
450
	/**
451
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
452
	 * Check if the chart bidi text direction is RTL
453
	 * @author BIDI ACGC
454
	 */
455
	public boolean  isRtlDirection()
456
	{
457
		if ("rtl".equalsIgnoreCase(getDirection()))
458
			return true;
459
		else
460
			return false;
461
	}
462
	//bidi_acgc added end
422
	/**
463
	/**
423
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
464
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
424
	 * @generated
465
	 * @generated

Return to bug 225540