Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 148405

Summary: Improve usability of Chart Scripting editor
Product: z_Archived Reporter: David Michonneau <dmichonneau>
Component: BIRTAssignee: Zhiqiang Qian <zqian>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: 2.1.0   
Target Milestone: 2.2.1   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 179300, 188862, 196257    
Bug Blocks:    

Description David Michonneau CLA 2006-06-23 11:58:25 EDT
The Designer should provide a scripting editor for chart, similar as the one 
for other report items:

1- Auto-color of keywords
2- Auto-completion
3- List methods in dropdown (note that parameters types and name should also be 
listed there with the method names, for instance: beforeGeneration(Chart chart, 
RuntimeContext context). 
4- Each implemented method should be shown in bold in the dropdown
5- Each method should have a description to help the user understand it (as a 
tooltip for instance)
6- The whole script should still be shown at once, the dropdown is only used 
for navigation 

Method names should not be hard-coded, so an extension point can be requested 
by designer to pass such information (method name, parameter types, 
description), if there isn't any available yet.

Note that the chart can only pass the whole script to the designer, which needs 
to parse for functions to make the dropdown navigation work. It's ok if the 
dropdown is ineffective if there are some syntax errors in the script (that 
prevent parsing).

Clicking on an empty method in the dropdown will automatically create a 
signature in the script body with the function name and default parameter names.
Comment 1 Wang Qiangsheng CLA 2006-09-27 04:18:22 EDT
Consider to support this as part of java script editor enhancment.
Comment 2 Wang Qiangsheng CLA 2007-02-28 05:18:47 EST
This depends on the integration of Aptana's JS editor.
That integration can be done in M6, we can't finish this in M6 too.
Comment 3 David Michonneau CLA 2007-03-03 19:07:46 EST
Please specify what you require from the chart side to integrate the chart 
script editing in this new JS editor (bug 132031)
Comment 4 David Michonneau CLA 2007-03-26 10:00:17 EDT
UI implementation tasks:

Use the new API from Model (bug179300)
Implement mockup of bug132031
Provide Palette provider interface so extended item can hide/show contents in 
Palette.
Investigate auto-completion support for extended items
Comment 5 Wang Qiangsheng CLA 2007-05-22 06:04:49 EDT
I suggest we add the drop down box without the integration with model/engine API this week, and hooked up the API calls later,
Comment 6 Hongchang Lin CLA 2007-05-22 23:59:36 EDT
Added a combo box on JS editor.
Comment 7 Wang Qiangsheng CLA 2007-05-23 00:31:50 EDT
We have added the combo box
Thanks
Comment 8 David Michonneau CLA 2007-05-31 11:35:50 EDT
Implemented the dropdown logic to create new functions, hooked new API calls to 
retrieve signatures, save and load script contents from extended items.

Reassigning to UI team for further enhancements such as auto-completion and 
possible polishing of the dropdown functionalities (pending on SWT enhancements 
on dropdown capabilities, currently it's not possible to format one item in a 
dropdown independently of others).
Comment 9 Wenbin He CLA 2007-07-10 20:07:48 EDT
For the auto completion open issue, it is a key usability issue for chart scripting that we want to solve in BIRT 2.2.  I think we can continue to use KEY word based auto completion that we have implemented for other report item's scripts. For built-in report items, we use the context object name as the key, which is valid for the entire script. For example, if you write script for a Label.onPrepare,  the key word "this"/"reportContext" will be used to refer to a ILabel object. This information is defined in ROM through the Label's onPrepare method definition:

  <Element canExtend="true" displayNameID="Element.Label" extends="ReportItem" isAbstract="false" javaClass="org.eclipse.birt.report.model.elements.Label" name="Label" selector="label" since="1.0" xmlName="label">

.. 
  
    <Method context="startup" displayNameID="Element.Label.onPrepare" name="onPrepare" since="2.0" toolTipID="Element.Label.onPrepare.toolTip">


      <Argument name="this" tagID="Element.Label.onPrepare.this" type="org.eclipse.birt.report.engine.api.script.element.ILabel"/>

 

      <Argument name="reportContext" tagID="Element.Label.onPrepare.reportContext" type="org.eclipse.birt.report.engine.api.script.IReportContext"/>

 

    </Method> 
  
... 
  
</element> 
  
   
Similarly, chart should also define methods and sub methods as following in chart extension plugin.xml: 
   
onRender: 
   
    <Method context="presentation" displayNameID="Element.Label.onRender" name="onRender" since="1.0" toolTipID="Element.Label.onRender.toolTip">
    </Method> 
    
All sub methods should use the same context "onPrepare" 
    
    <Method context="onPrepare" displayNameID="Chart.beforeDataSetFilled" name="beforeDataSetFilled( series, dataSetProcessor, context )" since="2.1" toolTipID="Chart.beforeDataSetFilled">

 

      <Argument name="series" tagID="Chart.beforeDataSetFilled.series" type="org.eclipse.birt.chart..../Series"/> 
  
      <Argument name="dataSetProcessor" tagID="Chart.beforeDataSetFilled.dataSetProcessor" type="org.eclipse.birt.chart.. DataSetProcessor"/>

 

      <Argument name="context" tagID="Chart.beforeDataSetFilled.context" type="org.eclipse.birt.chart..IChartScriptContext"/>

 

    </Method> 
  
With this information, GUI can use key word "series", "datasetProcessor", and "context" as the key word for auto completion. Also these three key words are valid only within the beforeDataSetFilled() function. So to make the auto completion to be more intelligent, JS editor need to parse the script, and it is whether the key word is within the defined function. Fortunately, Rhnio has provided a script parser that can serve this purpose. I have sent the instruction to Qiangsheng. This should be not be a problem.

  

Comment 10 Zhiqiang Qian CLA 2007-07-12 22:47:21 EDT
Added support for chart script auto-completion and lower the priority for other future enhancement, e.g. dropdown poslishing, function jump, etc.
Comment 11 Wenfeng Li CLA 2007-07-18 04:11:07 EDT
please verify the main enhancements and log another enh bug for further UI improvements.
Comment 12 David Michonneau CLA 2007-08-01 10:07:06 EDT
further UI improvements logged in bug198530