Java Object in Chart Scripts [message #244312] |
Fri, 22 June 2007 15:29 |
Eclipse User |
|
|
|
Originally posted by: justin.tradingmetrics.com
How can you make a java object visible to a chart script?
addScriptableJavaObject doesn't seem to do the trick.
|
|
|
|
Re: Java Object in Chart Scripts [message #244350 is a reply to message #244341] |
Fri, 22 June 2007 15:57 |
Eclipse User |
|
|
|
Originally posted by: justin.tradingmetrics.com
It is running in a BIRT report, and it is an instance of a custom class.
I want to do something similar to when you fill in columns for a scripted
data set, except use the java object to fill in legend information.
David Michonneau wrote:
> First you need to import it with
> importPackages(Packages.yourclass.full.name). This is the Rhino syntax. Then
> I need more details to answer:
> Is your chart running in standalone or inside a BIRT report?
> Is the java object you refer to a standard Java object such as string or you
> own custom class?
> Thanks,
> David
> "Justin" <justin@tradingmetrics.com> wrote in message
> news:7d200668edea2b8349c5e054568c5635$1@www.eclipse.org...
>> How can you make a java object visible to a chart script?
>> addScriptableJavaObject doesn't seem to do the trick.
>>
|
|
|
|
Re: Java Object in Chart Scripts [message #244395 is a reply to message #244390] |
Fri, 22 June 2007 18:26 |
Eclipse User |
|
|
|
Originally posted by: justin.tradingmetrics.com
I found that method but couldn't figure out how to use it from the
documentation (or even the type it's supposed to return or from where.)
Could you tell me how to do that? If I called addScriptableJavaObject(
myObject ) does that mean that it is already in the context?
If not, how do I put it there?
If so, how do I access it?
Justin
David Michonneau wrote:
> Can you access that object from the report context object? If so, you can
> retrieve that context in any chart script, by using context.getScriptable().
> Thanks,
> David
> "Justin" <justin@tradingmetrics.com> wrote in message
> news:c8800a87fb77125e02baeb3861f63604$1@www.eclipse.org...
>> It is running in a BIRT report, and it is an instance of a custom class.
>>
>> I want to do something similar to when you fill in columns for a scripted
>> data set, except use the java object to fill in legend information.
>>
>>
>> David Michonneau wrote:
>>
>>> First you need to import it with
>>> importPackages(Packages.yourclass.full.name). This is the Rhino syntax.
>>> Then I need more details to answer:
>>
>>> Is your chart running in standalone or inside a BIRT report?
>>> Is the java object you refer to a standard Java object such as string or
>>> you own custom class?
>>
>>> Thanks,
>>
>>> David
>>
>>> "Justin" <justin@tradingmetrics.com> wrote in message
>>> news:7d200668edea2b8349c5e054568c5635$1@www.eclipse.org...
>>>> How can you make a java object visible to a chart script?
>>>> addScriptableJavaObject doesn't seem to do the trick.
>>>>
>>
>>
|
|
|
Please Help!! [message #244574 is a reply to message #244395] |
Mon, 25 June 2007 13:08 |
Eclipse User |
|
|
|
Originally posted by: emdeefive.gmail.com
Could someone please help me out here?
Specifically,
1. How can I make a Java object accessible from a chart script (I think
more specifically from the IChartScriptContext object that is already
visible) and,
2. How can I access the Java object from the context object.
In a scripted data set, the method you use would be
addScriptableJavaObject, is there a similar method to make such an object
part of the script context?
Please Help!
Justin
|
|
|
Re: Java Object in Chart Scripts [message #244664 is a reply to message #244395] |
Mon, 25 June 2007 19:13 |
David Michonneau Messages: 1145 Registered: July 2009 |
Senior Member |
|
|
addScriptableObject is deprecated, but you can register it in the appContext
of IReportContext. To access it in a chart script, if you use
IChartScriptContext.getExternalContext().getScriptable(), it will return you
an instance of IReportContext
So something like this should work:
function beforeGeneration(chart, icsc) //any chart script function here
{
icsc.getExternalContext().getScriptable().getAppContext().ge t( "variableName");
}
Thanks,
David
context.getScriptable().get
"Justin" <justin@tradingmetrics.com> wrote in message
news:e2b72acee7f5ad0d819598ef581dd3da$1@www.eclipse.org...
>I found that method but couldn't figure out how to use it from the
>documentation (or even the type it's supposed to return or from where.)
>
> Could you tell me how to do that? If I called addScriptableJavaObject(
> myObject ) does that mean that it is already in the context?
>
> If not, how do I put it there?
>
> If so, how do I access it?
>
> Justin
>
>
> David Michonneau wrote:
>
>> Can you access that object from the report context object? If so, you can
>> retrieve that context in any chart script, by using
>> context.getScriptable().
>
>> Thanks,
>
>> David
>
>> "Justin" <justin@tradingmetrics.com> wrote in message
>> news:c8800a87fb77125e02baeb3861f63604$1@www.eclipse.org...
>>> It is running in a BIRT report, and it is an instance of a custom class.
>>>
>>> I want to do something similar to when you fill in columns for a
>>> scripted data set, except use the java object to fill in legend
>>> information.
>>>
>>>
>>> David Michonneau wrote:
>>>
>>>> First you need to import it with
>>>> importPackages(Packages.yourclass.full.name). This is the Rhino syntax.
>>>> Then I need more details to answer:
>>>
>>>> Is your chart running in standalone or inside a BIRT report?
>>>> Is the java object you refer to a standard Java object such as string
>>>> or you own custom class?
>>>
>>>> Thanks,
>>>
>>>> David
>>>
>>>> "Justin" <justin@tradingmetrics.com> wrote in message
>>>> news:7d200668edea2b8349c5e054568c5635$1@www.eclipse.org...
>>>>> How can you make a java object visible to a chart script?
>>>>> addScriptableJavaObject doesn't seem to do the trick.
>>>>>
>>>
>>>
>
>
|
|
|
Re: Java Object in Chart Scripts [message #244700 is a reply to message #244664] |
Mon, 25 June 2007 20:16 |
Eclipse User |
|
|
|
Originally posted by: emdeefive.gmail.com
Much Thanks!!
I'd still been using addscriptablejavaobject because it had been easier
not to change it from older versions.
I didn't recognize that the IReportContext returned by getScriptable was
the same one being used in the Report Engine code.
So many contexts....
Thanks,
Justin
David Michonneau wrote:
> addScriptableObject is deprecated, but you can register it in the appContext
> of IReportContext. To access it in a chart script, if you use
> IChartScriptContext.getExternalContext().getScriptable(), it will return you
> an instance of IReportContext
> So something like this should work:
> function beforeGeneration(chart, icsc) //any chart script function here
> {
>
icsc.getExternalContext().getScriptable().getAppContext().ge t( "variableName");
> }
> Thanks,
> David
> context.getScriptable().get
> "Justin" <justin@tradingmetrics.com> wrote in message
> news:e2b72acee7f5ad0d819598ef581dd3da$1@www.eclipse.org...
>>I found that method but couldn't figure out how to use it from the
>>documentation (or even the type it's supposed to return or from where.)
>>
>> Could you tell me how to do that? If I called addScriptableJavaObject(
>> myObject ) does that mean that it is already in the context?
>>
>> If not, how do I put it there?
>>
>> If so, how do I access it?
>>
>> Justin
>>
>>
>> David Michonneau wrote:
>>
>>> Can you access that object from the report context object? If so, you can
>>> retrieve that context in any chart script, by using
>>> context.getScriptable().
>>
>>> Thanks,
>>
>>> David
>>
>>> "Justin" <justin@tradingmetrics.com> wrote in message
>>> news:c8800a87fb77125e02baeb3861f63604$1@www.eclipse.org...
>>>> It is running in a BIRT report, and it is an instance of a custom class.
>>>>
>>>> I want to do something similar to when you fill in columns for a
>>>> scripted data set, except use the java object to fill in legend
>>>> information.
>>>>
>>>>
>>>> David Michonneau wrote:
>>>>
>>>>> First you need to import it with
>>>>> importPackages(Packages.yourclass.full.name). This is the Rhino syntax.
>>>>> Then I need more details to answer:
>>>>
>>>>> Is your chart running in standalone or inside a BIRT report?
>>>>> Is the java object you refer to a standard Java object such as string
>>>>> or you own custom class?
>>>>
>>>>> Thanks,
>>>>
>>>>> David
>>>>
>>>>> "Justin" <justin@tradingmetrics.com> wrote in message
>>>>> news:7d200668edea2b8349c5e054568c5635$1@www.eclipse.org...
>>>>>> How can you make a java object visible to a chart script?
>>>>>> addScriptableJavaObject doesn't seem to do the trick.
>>>>>>
>>>>
>>>>
>>
>>
|
|
|
Powered by
FUDForum. Page generated in 0.04377 seconds