Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 94788 Details for
Bug 225540
Add BIDI support to BIRT charts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
BIDI support for Charts engine
acgc_chart_engine_bidi_patch.diff (text/plain), 10.68 KB, created by
Mohamed El-Kholy
on 2008-04-03 17:24:30 EDT
(
hide
)
Description:
BIDI support for Charts engine
Filename:
MIME Type:
Creator:
Mohamed El-Kholy
Created:
2008-04-03 17:24:30 EDT
Size:
10.68 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.birt.chart.engine >Index: src/org/eclipse/birt/chart/factory/RunTimeContext.java >=================================================================== >RCS file: /cvsroot/birt/source/org.eclipse.birt.chart.engine/src/org/eclipse/birt/chart/factory/RunTimeContext.java,v >retrieving revision 1.26 >diff -u -r1.26 RunTimeContext.java >--- src/org/eclipse/birt/chart/factory/RunTimeContext.java 28 Feb 2008 09:47:33 -0000 1.26 >+++ src/org/eclipse/birt/chart/factory/RunTimeContext.java 3 Apr 2008 21:19:07 -0000 >@@ -374,10 +374,13 @@ > */ > public boolean isRightToLeft( ) > { >- if ( iRightToLeft == -1 ) >+ // Report direction does no longer depend on Locale, and so the code below is commented out. >+ //bidi_acgc deleted start >+ /*if ( iRightToLeft == -1 ) > { > iRightToLeft = ChartUtil.isRightToLeftLocale( lcl ) ? 1 : 0; >- } >+ }*/ >+ //bidi_acgc deleted end > return iRightToLeft == 1; > } > >Index: src/org/eclipse/birt/chart/factory/Generator.java >=================================================================== >RCS file: /cvsroot/birt/source/org.eclipse.birt.chart.engine/src/org/eclipse/birt/chart/factory/Generator.java,v >retrieving revision 1.68 >diff -u -r1.68 Generator.java >--- src/org/eclipse/birt/chart/factory/Generator.java 28 Feb 2008 09:47:33 -0000 1.68 >+++ src/org/eclipse/birt/chart/factory/Generator.java 3 Apr 2008 21:19:07 -0000 >@@ -655,6 +655,10 @@ > > // Update the context with a locale if it is undefined. > final Chart cmRunTime = (Chart) EcoreUtil.copy( model ); >+ //bidi_acgc added start // Workaround because EcoreUtil.copy method is not aware of the direction property of charts >+ if (model != null) >+ cmRunTime.setDirection(model.getDirection()); >+ //bidi_acgc added end > rtc.setULocale( locale != null ? locale : ULocale.getDefault( ) ); > > ChartScriptContext csc = new ChartScriptContext( ); >@@ -891,6 +895,12 @@ > // re-init chart script context. > ChartScriptContext csc = new ChartScriptContext( ); > Chart cmRunTime = (Chart) EcoreUtil.copy( cmDesignTime ); >+ //bidi_acgc added start >+ //Make the model aware of the direction property updates >+ Chart tempChart = ((Chart) EcoreUtil.copy( cmDesignTime )); >+ if (cmDesignTime != null) >+ cmRunTime.setDirection(cmDesignTime.getDirection()); >+ //bidi_acgc added end > ChartUtil.pruneInvisibleSeries( cmRunTime ); > csc.setChartInstance( cmRunTime ); > csc.setExternalContext( externalContext ); >Index: src/org/eclipse/birt/chart/event/TextRenderEvent.java >=================================================================== >RCS file: /cvsroot/birt/source/org.eclipse.birt.chart.engine/src/org/eclipse/birt/chart/event/TextRenderEvent.java,v >retrieving revision 1.13 >diff -u -r1.13 TextRenderEvent.java >--- src/org/eclipse/birt/chart/event/TextRenderEvent.java 8 Sep 2006 07:02:59 -0000 1.13 >+++ src/org/eclipse/birt/chart/event/TextRenderEvent.java 3 Apr 2008 21:19:06 -0000 >@@ -21,6 +21,7 @@ > import org.eclipse.birt.chart.model.attribute.impl.BoundsImpl; > import org.eclipse.birt.chart.model.attribute.impl.LocationImpl; > import org.eclipse.birt.chart.model.attribute.impl.TextAlignmentImpl; >+import org.eclipse.birt.chart.model.attribute.Text;// bidi_acgc added > import org.eclipse.birt.chart.model.component.Label; > import org.eclipse.birt.chart.model.component.impl.LabelImpl; > import org.eclipse.birt.chart.model.layout.LabelBlock; >@@ -119,7 +120,24 @@ > { > _boBlock = boBlock; > } >- >+ //bidi_acgc added start >+ /** >+ * Adds the "RLE" and "PDF" unicode control characters to label caption where "RLE" is added to the beginning and "PDF" to the end >+ * to apply right to left reading order >+ */ >+ public final void setRtlCaption() >+ { >+ Label lbl = this.getLabel(); >+ if (lbl != null) >+ { >+ Text txt = lbl.getCaption(); >+ String val = txt.getValue(); >+ if (val.length() > 0) >+ if ('\u202b' != val.charAt(0)) >+ txt.setValue( '\u202b' + val + '\u202c'); >+ } >+ } >+ //bidi_acgc added end > /** > * @return Returns the block bounds of the text. > */ >Index: src/org/eclipse/birt/chart/render/BaseRenderer.java >=================================================================== >RCS file: /cvsroot/birt/source/org.eclipse.birt.chart.engine/src/org/eclipse/birt/chart/render/BaseRenderer.java,v >retrieving revision 1.105 >diff -u -r1.105 BaseRenderer.java >--- src/org/eclipse/birt/chart/render/BaseRenderer.java 20 Feb 2008 10:17:43 -0000 1.105 >+++ src/org/eclipse/birt/chart/render/BaseRenderer.java 3 Apr 2008 21:19:10 -0000 >@@ -1521,6 +1521,10 @@ > tre.setBlockAlignment( ta ); > tre.setLabel( lgTitle ); > tre.setAction( TextRenderEvent.RENDER_TEXT_IN_BLOCK ); >+ //bidi_acgc added start >+ if (cm.isRtlDirection()) >+ tre.setRtlCaption(); >+ //bidi_acgc added end > ipr.drawText( tre ); > } > } >@@ -1743,6 +1747,10 @@ > { > tre.setLabel( la ); > tre.setAction( TextRenderEvent.RENDER_TEXT_AT_LOCATION ); >+ //bidi_acgc added start >+ if (cm.isRtlDirection()) >+ tre.setRtlCaption(); >+ //bidi_acgc added end > ipr.drawText( tre ); > } > >@@ -1762,6 +1770,10 @@ > + 1, dValueWidth - 2, dExtraHeight - 1 ) ); > tre.setLabel( tmpLa ); > tre.setAction( TextRenderEvent.RENDER_TEXT_IN_BLOCK ); >+ //bidi_acgc added start >+ if (cm.isRtlDirection()) >+ tre.setRtlCaption(); >+ //bidi_acgc added end > ipr.drawText( tre ); > } > >@@ -2136,11 +2148,18 @@ > final LabelBlock lb = (LabelBlock) b; > final TextRenderEvent tre = (TextRenderEvent) ( (EventObjectCache) ipr ).getEventObject( oSource, > TextRenderEvent.class ); >- >+ //bidi_acgc added start >+ if (cm.isRtlDirection()) >+ tre.setRtlCaption(); >+ //bidi_acgc added end > // need backup original non-externalized value. > final String sRestoreValue = tre.updateFrom( lb, dScale, rtc ); > if ( lb.getLabel( ).isVisible( ) ) > { >+ //bidi_acgc added start >+ if (cm.isRtlDirection()) >+ tre.setRtlCaption(); >+ //bidi_acgc added end > ipr.drawText( tre ); > } > lb.getLabel( ).getCaption( ).setValue( sRestoreValue ); >Index: src/org/eclipse/birt/chart/render/AxesRenderHelper.java >=================================================================== >RCS file: /cvsroot/birt/source/org.eclipse.birt.chart.engine/src/org/eclipse/birt/chart/render/AxesRenderHelper.java,v >retrieving revision 1.24 >diff -u -r1.24 AxesRenderHelper.java >--- src/org/eclipse/birt/chart/render/AxesRenderHelper.java 14 Mar 2008 09:54:49 -0000 1.24 >+++ src/org/eclipse/birt/chart/render/AxesRenderHelper.java 3 Apr 2008 21:19:09 -0000 >@@ -809,6 +809,10 @@ > tre.setTextPosition( iLabelLocation ); > } > } >+ //bidi_acgc added start >+ if(this.renderer.cm.isRtlDirection()) >+ tre.setRtlCaption(); >+ //bidi_acgc added end > ipr.drawText( tre ); > } > } >@@ -1017,6 +1021,10 @@ > tre.setTextPosition( iLabelLocation ); > } > } >+ //bidi_acgc added start >+ if(this.renderer.cm.isRtlDirection()) >+ tre.setRtlCaption(); >+ //bidi_acgc added end > ipr.drawText( tre ); > } > } >@@ -1621,6 +1629,10 @@ > tre.setAction( TextRenderEvent.RENDER_TEXT_IN_BLOCK ); > if ( ax.getTitle( ).isVisible( ) ) > { >+ //bidi_acgc added start >+ if(this.renderer.cm.isRtlDirection()) >+ tre.setRtlCaption(); >+ //bidi_acgc added end > ipr.drawText( tre ); > } > } >@@ -2058,6 +2070,10 @@ > .getAlignment( ) ) ); > } > tre.setAction( TextRenderEvent.RENDER_TEXT_IN_BLOCK ); >+ //bidi_acgc added start >+ if(this.renderer.cm.isRtlDirection()) >+ tre.setRtlCaption(); >+ //bidi_acgc added end > ipr.drawText( tre ); > } > } >Index: src/org/eclipse/birt/chart/model/Chart.java >=================================================================== >RCS file: /cvsroot/birt/source/org.eclipse.birt.chart.engine/src/org/eclipse/birt/chart/model/Chart.java,v >retrieving revision 1.13 >diff -u -r1.13 Chart.java >--- src/org/eclipse/birt/chart/model/Chart.java 31 Oct 2005 02:29:54 -0000 1.13 >+++ src/org/eclipse/birt/chart/model/Chart.java 3 Apr 2008 21:19:08 -0000 >@@ -139,7 +139,25 @@ > * @generated > */ > void setType( String value ); >+ //bidi_acgc added start >+ /* The code below is not generated. */ >+ >+ /** >+ * Returns the value of chart Direction<!-- begin-user-doc --> Gets the direction of this >+ * chart. <!-- end-user-doc --> <!-- begin-model-doc --> >+ */ >+ String getDirection( ); >+ /** >+ * begin-user-doc --> Sets the direction of this chart. >+ * <!-- end-user-doc --> >+ * >+ */ >+ >+ void setDirection(String value ); >+ >+ boolean isRtlDirection(); > >+ //bidi_acgc added end > /** > * Returns the value of the '<em><b>Sub Type</b></em>' attribute. <!-- begin-user-doc --> Gets the sub-type of > * this chart. <!-- end-user-doc --> <!-- begin-model-doc --> >Index: src/org/eclipse/birt/chart/model/impl/ChartImpl.java >=================================================================== >RCS file: /cvsroot/birt/source/org.eclipse.birt.chart.engine/src/org/eclipse/birt/chart/model/impl/ChartImpl.java,v >retrieving revision 1.31 >diff -u -r1.31 ChartImpl.java >--- src/org/eclipse/birt/chart/model/impl/ChartImpl.java 12 Sep 2007 07:13:53 -0000 1.31 >+++ src/org/eclipse/birt/chart/model/impl/ChartImpl.java 3 Apr 2008 21:19:08 -0000 >@@ -124,8 +124,16 @@ > * @ordered > */ > protected boolean versionESet = false; >+//bidi_acgc added start >+ >+ protected static final String DIRECTION_EDEFAULT = "ltr"; //$NON-NLS-1$ > > /** >+ * The code below is not generated from chart emf model >+ */ >+ protected String direction = DIRECTION_EDEFAULT; >+ //bidi_acgc added end >+ /** > * The default value of the '{@link #getType() <em>Type</em>}' attribute. > * <!-- begin-user-doc --> <!-- end-user-doc --> > * @see #getType() >@@ -418,7 +426,40 @@ > { > return type; > } >+ //bidi_acgc added start >+ /** >+ * <!-- begin-user-doc --> <!-- end-user-doc --> >+ * Gets chart bidi text direction >+ * @author BIDI ACGC >+ */ >+ >+ public String getDirection( ) >+ { >+ return direction; >+ } >+ /** >+ * <!-- begin-user-doc --> <!-- end-user-doc --> >+ * Sets chart bidi text direction >+ * @author BIDI ACGC >+ */ >+ public void setDirection( String newDirection) >+ { > >+ direction = newDirection; >+ } >+ /** >+ * <!-- begin-user-doc --> <!-- end-user-doc --> >+ * Check if the chart bidi text direction is RTL >+ * @author BIDI ACGC >+ */ >+ public boolean isRtlDirection() >+ { >+ if ("rtl".equalsIgnoreCase(getDirection())) >+ return true; >+ else >+ return false; >+ } >+ //bidi_acgc added end > /** > * <!-- begin-user-doc --> <!-- end-user-doc --> > * @generated
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
bjorn.freeman-benson
:
iplog+
khouly
:
review?
Actions:
View
|
Diff
Attachments on
bug 225540
: 94788 |
95144
|
95287
|
95756