Skip to main content



      Home
Home » Archived » BIRT » Source value can not be null
Source value can not be null [message #115194] Wed, 25 January 2006 03:00 Go to next message
Eclipse UserFriend
Hi,

I am using eclipse 3.1.1 and BIRT 2.0.0 version.
I get “org.eclipse.birt.chart.exception.ChartException: $NO-RB$ Source
value can not be null” exception while loading the Chart.rptdesign file
and rendering it on canvas.

Here is the rptdesign file which I am trying to load and render.

<?xml version="1.0" encoding="UTF-8"?>
<!-- Written by Eclipse BIRT 2.0 -->
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3" id="1">
<property name="units">in</property>
<data-sources>
<script-data-source name="Data Source" id="4"/>
</data-sources>
<data-sets>
<script-data-set name="Java UI table" id="5">
<property name="dataSource">Data Source</property>
<list-property name="resultSet">
<structure>
<property name="position">0</property>
<property name="name">1_Column(Numeric)</property>
<property name="dataType">decimal</property>
</structure>
<structure>
<property name="position">1</property>
<property name="name">2_Asset_number</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">3_Seq(Numeric)</property>
<property name="dataType">decimal</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">4_Type</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">5_Group</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">5</property>
<property name="name">6_Short_desc</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">6</property>
<property name="name">7_Acq_date(Numeric)</property>
<property name="dataType">decimal</property>
</structure>
<structure>
<property name="position">7</property>
<property name="name">8_Nature</property>
<property name="dataType">string</property>
</structure>
</list-property>
<list-property name="columnHints">
<structure>
<property
name="columnName">1_Column(Numeric)</property>
</structure>
<structure>
<property name="columnName">2_Asset_number</property>
</structure>
<structure>
<property name="columnName">3_Seq(Numeric)</property>
</structure>
<structure>
<property name="columnName">4_Type</property>
</structure>
<structure>
<property name="columnName">5_Group</property>
</structure>
<structure>
<property name="columnName">6_Short_desc</property>
</structure>
<structure>
<property
name="columnName">7_Acq_date(Numeric)</property>
</structure>
<structure>
<property name="columnName">8_Nature</property>
</structure>
</list-property>
<method name="open"><![CDATA[i=0;sourcedata = new Array( new
Array(8), new Array(8), new Array(8), new Array(8), new Array(8), new
Array(8), new Array(8), new Array(8), new Array(8), new Array(8), new
Array(8), new Array(8), new Array(8));sourcedata[0][0]=
0.0;sourcedata[0][1]= "";sourcedata[0][2]= 0.0;sourcedata[0][3]=
"VEH";sourcedata[0][4]= "SWE";sourcedata[0][5]= "SAAB
9-5SE";sourcedata[0][6]= 121199.0;sourcedata[0][7]= "6";sourcedata[1][0]=
0.0;sourcedata[1][1]= "00000000002";sourcedata[1][2]=
0.0;sourcedata[1][3]= "YWW";sourcedata[1][4]= "";sourcedata[1][5]=
"ASDF";sourcedata[1][6]= 11003.0;sourcedata[1][7]= "6";sourcedata[2][0]=
0.0;sourcedata[2][1]= "00000000003";sourcedata[2][2]=
0.0;sourcedata[2][3]= "YWW";sourcedata[2][4]= "001";sourcedata[2][5]=
"ASDF";sourcedata[2][6]= 11003.0;sourcedata[2][7]= "6";sourcedata[3][0]=
0.0;sourcedata[3][1]= "00000000004";sourcedata[3][2]=
0.0;sourcedata[3][3]= "YWW";sourcedata[3][4]= "002";sourcedata[3][5]=
"ASDF";sourcedata[3][6]= 11003.0;sourcedata[3][7]= "6";sourcedata[4][0]=
0.0;sourcedata[4][1]= "000000001";sourcedata[4][2]= 0.0;sourcedata[4][3]=
"BBB";sourcedata[4][4]= "";sourcedata[4][5]= "TO JEST
MO";sourcedata[4][6]= 300903.0;sourcedata[4][7]= "6";sourcedata[5][0]=
0.0;sourcedata[5][1]= "000000002";sourcedata[5][2]= 0.0;sourcedata[5][3]=
"BBB";sourcedata[5][4]= "AAA";sourcedata[5][5]= "ASDF";sourcedata[5][6]=
300903.0;sourcedata[5][7]= "6";sourcedata[6][0]= 0.0;sourcedata[6][1]=
"000000003";sourcedata[6][2]= 0.0;sourcedata[6][3]=
"BBB";sourcedata[6][4]= "BBB";sourcedata[6][5]= "TO JEST
AS";sourcedata[6][6]= 300903.0;sourcedata[6][7]= "6";sourcedata[7][0]=
0.0;sourcedata[7][1]= "0000001";sourcedata[7][2]= 0.0;sourcedata[7][3]=
"VEH";sourcedata[7][4]= "";sourcedata[7][5]= "FHJKG";sourcedata[7][6]=
91100.0;sourcedata[7][7]= "6";sourcedata[8][0]= 0.0;sourcedata[8][1]=
"0000101";sourcedata[8][2]= 0.0;sourcedata[8][3]= "VEH";sourcedata[8][4]=
"SWE";sourcedata[8][5]= "VVO760CAB";sourcedata[8][6]=
100499.0;sourcedata[8][7]= "B";sourcedata[9][0]= 0.0;sourcedata[9][1]=
"0000102";sourcedata[9][2]= 0.0;sourcedata[9][3]= "VEH";sourcedata[9][4]=
"SWE";sourcedata[9][5]= "VVO760CBI";sourcedata[9][6]=
300699.0;sourcedata[9][7]= "B";sourcedata[10][0]= 0.0;sourcedata[10][1]=
"0000103";sourcedata[10][2]= 0.0;sourcedata[10][3]=
"VEH";sourcedata[10][4]= "VAN";sourcedata[10][5]=
"VVO760VAN";sourcedata[10][6]= 101099.0;sourcedata[10][7]=
"6";sourcedata[11][0]= 0.0;sourcedata[11][1]= "AAA1122";sourcedata[11][2]=
0.0;sourcedata[11][3]= "VEH";sourcedata[11][4]= "SWE";sourcedata[11][5]=
"T";sourcedata[11][6]= 280102.0;sourcedata[11][7]= "6";sourcedata[12][0]=
0.0;sourcedata[12][1]= "AAA1133";sourcedata[12][2]= 0.0;sourcedata[12][3]=
"VEH";sourcedata[12][4]= "SWE";sourcedata[12][5]=
"JACEK";sourcedata[12][6]= 280102.0;sourcedata[12][7]= "6";]]></method>
<method name="fetch"><![CDATA[if (i<
13){row["1_Column(Numeric)"] = sourcedata[i][0];row["2_Asset_number"] =
sourcedata[i][1];row["3_Seq(Numeric)"] = sourcedata[i][2];row["4_Type"] =
sourcedata[i][3];row["5_Group"] = sourcedata[i][4];row["6_Short_desc"] =
sourcedata[i][5];row["7_Acq_date(Numeric)"] =
sourcedata[i][6];row["8_Nature"] = sourcedata[i][7];i++; return true;}
else return false;]]></method>
</script-data-set>
</data-sets>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<page-footer>
<text id="3">
<property name="contentType">html</property>
<text-property name="content"><![CDATA[<value-of>new
Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
<body>
<extended-item extensionName="Chart" id="6">
<property name="height">250pt</property>
<property name="width">400pt</property>
<property name="dataSet">Java UI table</property>
<xml-property
name="xmlRepresentation"><![CDATA[<model:ChartWithAxes
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:attribute="http://www.birt.eclipse.org/ChartModelAttribute"
xmlns:data="http://www.birt.eclipse.org/ChartModelData"
xmlns:layout="http://www.birt.eclipse.org/ChartModelLayout"
xmlns:model="http://www.birt.eclipse.org/ChartModel"
xmlns:type="http://www.birt.eclipse.org/ChartModelType">
<Type>Bar Chart</Type>
<SubType>Side-by-side</SubType>
<Block>
<Children xsi:type="layout:TitleBlock">
<Bounds>
<Left>0.0</Left>
<Top>0.0</Top>
<Width>0.0</Width>
<Height>0.0</Height>
</Bounds>
<Insets>
<Top>3.0</Top>
<Left>3.0</Left>
<Bottom>3.0</Bottom>
<Right>3.0</Right>
</Insets>
<Row>-1</Row>
<Column>-1</Column>
<Rowspan>-1</Rowspan>
<Columnspan>-1</Columnspan>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Visible>true</Visible>
<Label>
<Caption>
<Value>Asset file maintenance > Overview selection</Value>
<Font>
<Name>Verdana</Name>
<Size>14.0</Size>
<Bold>true</Bold>
<Alignment>
<horizontalAlignment>Center</horizontalAlignment>
<verticalAlignment>Center</verticalAlignment>
</Alignment>
</Font>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>true</Visible>
</Label>
</Children>
<Children xsi:type="layout:Plot">
<Bounds>
<Left>0.0</Left>
<Top>0.0</Top>
<Width>0.0</Width>
<Height>0.0</Height>
</Bounds>
<Insets>
<Top>3.0</Top>
<Left>3.0</Left>
<Bottom>3.0</Bottom>
<Right>3.0</Right>
</Insets>
<Row>-1</Row>
<Column>-1</Column>
<Rowspan>-1</Rowspan>
<Columnspan>-1</Columnspan>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Visible>true</Visible>
<HorizontalSpacing>5</HorizontalSpacing>
<VerticalSpacing>5</VerticalSpacing>
<ClientArea>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>0</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>0.0</Left>
<Bottom>0.0</Bottom>
<Right>0.0</Right>
</Insets>
</ClientArea>
</Children>
<Children xsi:type="layout:Legend">
<Bounds>
<Left>0.0</Left>
<Top>0.0</Top>
<Width>0.0</Width>
<Height>0.0</Height>
</Bounds>
<Insets>
<Top>3.0</Top>
<Left>3.0</Left>
<Bottom>3.0</Bottom>
<Right>3.0</Right>
</Insets>
<Row>-1</Row>
<Column>-1</Column>
<Rowspan>-1</Rowspan>
<Columnspan>-1</Columnspan>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Visible>true</Visible>
<ClientArea>
<Outline>
<Style>Solid</Style>
<Thickness>0</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Insets>
<Top>2.0</Top>
<Left>2.0</Left>
<Bottom>2.0</Bottom>
<Right>2.0</Right>
</Insets>
</ClientArea>
<Text>
<Value>&lt;undefined></Value>
<Font>
<Name>Verdana</Name>
<Size>10.0</Size>
<Alignment/>
</Font>
</Text>
<Orientation>Vertical</Orientation>
<Direction>Top_Bottom</Direction>
<Position>Right</Position>
<ItemType>Series</ItemType>
<Title>
<Caption>
<Value>&lt;undefined></Value>
<Font>
<Alignment/>
</Font>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>false</Visible>
</Title>
<TitlePosition>Above</TitlePosition>
</Children>
<Bounds>
<Left>0.0</Left>
<Top>0.0</Top>
<Width>400.0</Width>
<Height>250.0</Height>
</Bounds>
<Insets>
<Top>3.0</Top>
<Left>3.0</Left>
<Bottom>3.0</Bottom>
<Right>3.0</Right>
</Insets>
<Row>-1</Row>
<Column>-1</Column>
<Rowspan>-1</Rowspan>
<Columnspan>-1</Columnspan>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Visible>true</Visible>
</Block>
<Dimension>Two_Dimensional</Dimension>
<Units>Points</Units>
<SeriesThickness>10.0</SeriesThickness>
<SampleData>
<BaseSampleData>
<DataSetRepresentation>A, B, C</DataSetRepresentation>
</BaseSampleData>
<OrthogonalSampleData>
<DataSetRepresentation>5,4,12</DataSetRepresentation>
<SeriesDefinitionIndex>0</SeriesDefinitionIndex>
</OrthogonalSampleData>
</SampleData>
<Interactivity/>
<Axes>
<Type>Text</Type>
<Title>
<Caption>
<Value>Asset number</Value>
<Font>
<Name>Verdana</Name>
<Size>14.0</Size>
<Bold>true</Bold>
<Alignment>
<horizontalAlignment>Center</horizontalAlignment>
<verticalAlignment>Center</verticalAlignment>
</Alignment>
</Font>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>false</Visible>
</Title>
<TitlePosition>Below</TitlePosition>
<AssociatedAxes>
<Type>Linear</Type>
<Title>
<Caption>
<Value></Value>
<Font>
<Name>Verdana</Name>
<Size>14.0</Size>
<Bold>true</Bold>
<Alignment>
<horizontalAlignment>Center</horizontalAlignment>
<verticalAlignment>Center</verticalAlignment>
</Alignment>
<Rotation>90.0</Rotation>
</Font>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>false</Visible>
</Title>
<TitlePosition>Left</TitlePosition>
<SeriesDefinitions>
<Query>
<Definition></Definition>
</Query>
<SeriesPalette>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>80</Red>
<Green>166</Green>
<Blue>218</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>242</Red>
<Green>88</Green>
<Blue>106</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>232</Red>
<Green>172</Green>
<Blue>57</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>255</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>64</Red>
<Green>128</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>192</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>170</Red>
<Green>85</Green>
<Blue>85</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>0</Blue>
</Entries>
</SeriesPalette>
<Series xsi:type="type:BarSeries">
<Visible>true</Visible>
<Label>
<Caption>
<Value>&lt;undefined></Value>
<Font>
<Name>Verdana</Name>
<Size>10.0</Size>
<Alignment/>
</Font>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>false</Visible>
</Label>
<DataDefinition>
<Definition>row[&quot;1_Column(Numeric)&quot;]</Definition >
</DataDefinition>
<SeriesIdentifier>&lt;undefined></SeriesIdentifier>
<DataPoint>
<Components>
<Type>Orthogonal_Value</Type>
</Components>
<Separator>, </Separator>
</DataPoint>
<LabelPosition>Outside</LabelPosition>
<Stacked>false</Stacked>
<Riser>Rectangle</Riser>
</Series>
<Grouping>
<Enabled>false</Enabled>
<GroupingInterval>2</GroupingInterval>
<GroupType>Text</GroupType>
<AggregateExpression>Sum</AggregateExpression>
</Grouping>
</SeriesDefinitions>
<SeriesDefinitions>
<Query>
<Definition></Definition>
</Query>
<SeriesPalette>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>242</Red>
<Green>88</Green>
<Blue>106</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>232</Red>
<Green>172</Green>
<Blue>57</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>255</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>64</Red>
<Green>128</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>192</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>170</Red>
<Green>85</Green>
<Blue>85</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>0</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>80</Red>
<Green>166</Green>
<Blue>218</Blue>
</Entries>
</SeriesPalette>
<Series xsi:type="type:BarSeries">
<Visible>true</Visible>
<Label>
<Caption>
<Value>&lt;undefined></Value>
<Font>
<Name>Verdana</Name>
<Size>10.0</Size>
<Alignment/>
</Font>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>false</Visible>
</Label>
<DataDefinition>
<Definition>row[&quot;3_Seq(Numeric)&quot;]</Definition >
</DataDefinition>
<SeriesIdentifier>&lt;undefined></SeriesIdentifier>
<DataPoint>
<Components>
<Type>Orthogonal_Value</Type>
</Components>
<Separator>, </Separator>
</DataPoint>
<LabelPosition>Outside</LabelPosition>
<Stacked>false</Stacked>
<Riser>Rectangle</Riser>
</Series>
<Grouping>
<Enabled>false</Enabled>
<GroupingInterval>2</GroupingInterval>
<GroupType>Text</GroupType>
<AggregateExpression>Sum</AggregateExpression>
</Grouping>
</SeriesDefinitions>
<SeriesDefinitions>
<Query>
<Definition></Definition>
</Query>
<SeriesPalette>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>232</Red>
<Green>172</Green>
<Blue>57</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>255</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>64</Red>
<Green>128</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>192</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>170</Red>
<Green>85</Green>
<Blue>85</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>0</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>80</Red>
<Green>166</Green>
<Blue>218</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>242</Red>
<Green>88</Green>
<Blue>106</Blue>
</Entries>
</SeriesPalette>
<Series xsi:type="type:BarSeries">
<Visible>true</Visible>
<Label>
<Caption>
<Value>&lt;undefined></Value>
<Font>
<Name>Verdana</Name>
<Size>10.0</Size>
<Alignment/>
</Font>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>false</Visible>
</Label>
<DataDefinition>
<Definition>row[&quot;7_Acq_date(Numeric)&quot;]</Definition >
</DataDefinition>
<SeriesIdentifier>&lt;undefined></SeriesIdentifier>
<DataPoint>
<Components>
<Type>Orthogonal_Value</Type>
</Components>
<Separator>, </Separator>
</DataPoint>
<LabelPosition>Outside</LabelPosition>
<Stacked>false</Stacked>
<Riser>Rectangle</Riser>
</Series>
<Grouping>
<Enabled>false</Enabled>
<GroupingInterval>2</GroupingInterval>
<GroupType>Text</GroupType>
<AggregateExpression>Sum</AggregateExpression>
</Grouping>
</SeriesDefinitions>
<Orientation>Vertical</Orientation>
<LineAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>true</Visible>
</LineAttributes>
<Label>
<Caption>
<Value>&lt;undefined></Value>
<Font>
<Name>Verdana</Name>
<Size>10.0</Size>
<Alignment/>
</Font>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>true</Visible>
</Label>
<LabelPosition>Left</LabelPosition>
<MajorGrid>
<LineAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>196</Red>
<Green>196</Green>
<Blue>196</Blue>
</Color>
<Visible>false</Visible>
</LineAttributes>
<TickStyle>Across</TickStyle>
<TickAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>196</Red>
<Green>196</Green>
<Blue>196</Blue>
</Color>
<Visible>true</Visible>
</TickAttributes>
</MajorGrid>
<MinorGrid>
<LineAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>225</Red>
<Green>225</Green>
<Blue>225</Blue>
</Color>
<Visible>false</Visible>
</LineAttributes>
<TickStyle>Across</TickStyle>
<TickAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>225</Red>
<Green>225</Green>
<Blue>225</Blue>
</Color>
<Visible>false</Visible>
</TickAttributes>
</MinorGrid>
<Scale>
<MinorGridsPerUnit>5</MinorGridsPerUnit>
</Scale>
<Origin>
<Type>Min</Type>
<Value xsi:type="data:NumberDataElement">
<Value>0.0</Value>
</Value>
</Origin>
<PrimaryAxis>true</PrimaryAxis>
<Percent>false</Percent>
</AssociatedAxes>
<SeriesDefinitions>
<Query>
<Definition></Definition>
</Query>
<SeriesPalette>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>80</Red>
<Green>166</Green>
<Blue>218</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>242</Red>
<Green>88</Green>
<Blue>106</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>232</Red>
<Green>172</Green>
<Blue>57</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>255</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>64</Red>
<Green>128</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>192</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>170</Red>
<Green>85</Green>
<Blue>85</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>0</Blue>
</Entries>
</SeriesPalette>
<Series>
<Visible>true</Visible>
<Label>
<Caption>
<Value>&lt;undefined></Value>
<Font>
<Alignment/>
</Font>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>false</Visible>
</Label>
<DataDefinition>
<Definition>row[&quot;2_Asset_number&quot;]</Definition >
</DataDefinition>
<SeriesIdentifier>&lt;undefined></SeriesIdentifier>
<DataPoint>
<Components>
<Type>Orthogonal_Value</Type>
</Components>
<Separator>, </Separator>
</DataPoint>
<LabelPosition>Outside</LabelPosition>
<Stacked>false</Stacked>
</Series>
<Grouping>
<Enabled>false</Enabled>
<GroupingInterval>2</GroupingInterval>
<GroupType>Text</GroupType>
<AggregateExpression>Sum</AggregateExpression>
</Grouping>
</SeriesDefinitions>
<Orientation>Horizontal</Orientation>
<LineAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>true</Visible>
</LineAttributes>
<Label>
<Caption>
<Value>&lt;undefined></Value>
<Font>
<Name>Verdana</Name>
<Size>10.0</Size>
<Alignment/>
</Font>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>true</Visible>
</Label>
<LabelPosition>Below</LabelPosition>
<MajorGrid>
<LineAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>196</Red>
<Green>196</Green>
<Blue>196</Blue>
</Color>
<Visible>false</Visible>
</LineAttributes>
<TickStyle>Across</TickStyle>
<TickAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>196</Red>
<Green>196</Green>
<Blue>196</Blue>
</Color>
<Visible>true</Visible>
</TickAttributes>
</MajorGrid>
<MinorGrid>
<LineAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>225</Red>
<Green>225</Green>
<Blue>225</Blue>
</Color>
<Visible>false</Visible>
</LineAttributes>
<TickStyle>Across</TickStyle>
<TickAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>225</Red>
<Green>225</Green>
<Blue>225</Blue>
</Color>
<Visible>false</Visible>
</TickAttributes>
</MinorGrid>
<Scale>
<MinorGridsPerUnit>5</MinorGridsPerUnit>
</Scale>
<Origin>
<Type>Min</Type>
<Value xsi:type="data:NumberDataElement">
<Value>0.0</Value>
</Value>
</Origin>
<PrimaryAxis>true</PrimaryAxis>
<CategoryAxis>true</CategoryAxis>
<Percent>false</Percent>
</Axes>
<Orientation>Vertical</Orientation>
<Rotation/>
</model:ChartWithAxes>
]]></xml-property>
</extended-item>
</body>
</report>


I am able to open this file in Eclipse’s Report Design perspective and
able to preview it without any error.
But while rendering the same on canvas, it gives exceptions.

The code was working fine with BIRT2.0M3 version, and chart was rendering
properly without any error.
But it’s not working with BIRT 2.0RC versions and BIRT2.0.0 version.

Code that I am using for rendering the chart:

public void paintControl(PaintEvent e) {
Chart chart = null;
try {
// Load chart from file and get it
chart = GraphDesignerUtility.getChart();
if (chart == null) {
// No chart available to render
}
else {
// Create copy of chart which will be used for rendering
Chart chartToRender = (Chart) EcoreUtil.copy( chart );

// Get a SWT device renderer
IDeviceRenderer deviceRenderer = null;
deviceRenderer = PluginSettings.instance().getDevice("dv.SWT");
deviceRenderer.setProperty(IDeviceRenderer.GRAPHICS_CONTEXT, e.gc);
//Make sure we stay in the client area's bounds
Rectangle rect = ((Composite) e.widget).getClientArea();

final Bounds bounds = BoundsImpl.create(rect.x + 2, rect.y + 2,
rect.width - 4, rect.height - 4);
bounds.scale(72d / deviceRenderer.getDisplayServer()
.getDpiResolution());

final Generator gr = Generator.instance( );

RunTimeContext rtc = new RunTimeContext();
// prepare the chart model.
//RunTimeContext rtc = Generator.instance( ).prepare( chartToRender,
// null,
// new BIRTScriptClassLoader( ),
// Locale.getDefault( ) );
//ScriptHandler sh = new ScriptHandler( );
rtc.setScriptHandler( sh );

//rtc.setEnableScripting( false );
GeneratedChartState state = gr.build( deviceRenderer.getDisplayServer(
),
chartToRender,
bounds,
null,
rtc,
null );
gr.render( deviceRenderer, state );
}
preservedValidChart = chart;
} catch (Exception ex) {
ex.printStackTrace();
graphView.refresh();
}

}


I also tried calling Generator’s prepare method, but found the same
problem.



Exception that application throws:

org.eclipse.birt.chart.exception.ChartException: $NO-RB$ Source value can
not be null
at org.eclipse.birt.chart.factory.Generator.render(Generator.ja va:1214)
at
ibsgraphs.graph.listener.GraphPaintListener.paintControl(Gra phPaintListener.java:119)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:83)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:867)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:852)
at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java:11 53)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3090 )
at org.eclipse.swt.widgets.Display.windowProc(Display.java:3706 )
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:16 56)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2711)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1699)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:367)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:143)
at net.ibs.ui.client.IBSJavaClient.run(IBSJavaClient.java:29)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:226)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:376)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:163)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
at org.eclipse.core.launcher.Main.run(Main.java:973)
at org.eclipse.core.launcher.Main.main(Main.java:948)
Caused by: java.lang.IllegalArgumentException: Source value can not be null
at
org.eclipse.birt.chart.event.PrimitiveRenderEvent.setSourceO bject(PrimitiveRenderEvent.java:278)
at
org.eclipse.birt.chart.event.EventObjectCache.getEventObject (EventObjectCache.java:94)
at
org.eclipse.birt.chart.factory.RunTimeContext.notifyStructur eChange(RunTimeContext.java:243)
at
org.eclipse.birt.chart.render.AxesRenderer.renderPlot(AxesRe nderer.java:2173)
at
org.eclipse.birt.chart.render.AxesRenderer.render(AxesRender er.java:191)
at org.eclipse.birt.chart.factory.Generator.render(Generator.ja va:1209)
... 28 more



Please advice.
Thank you.

Bharat Panchal
Re: Source value can not be null [message #115365 is a reply to message #115194] Wed, 25 January 2006 05:25 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Can you send me the code of GraphDesignerUtility? I would like to
investigate the problem. It sounds like the category runtime series is null.

Thanks,

David Michonneau
BIRT Committer

"Bharat Panchal" <bharat.panchal@patni.com> wrote in message
news:d34eabe4fda13f07b933526b9b8d7fd7$1@www.eclipse.org...
> Hi,
>
> I am using eclipse 3.1.1 and BIRT 2.0.0 version.
> I get
Re: Source value can not be null [message #115418 is a reply to message #115365] Wed, 25 January 2006 06:18 Go to previous messageGo to next message
Eclipse UserFriend
Hi David,
Thanks for quick reply.

Here is the code:

import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.StreamHandler;

import javax.swing.text.Document;
import javax.swing.text.EditorKit;
import javax.swing.text.html.HTMLEditorKit;

import org.eclipse.birt.chart.model.Chart;
import org.eclipse.birt.chart.reportitem.ChartReportItemImpl;
import org.eclipse.birt.chart.ui.swt.UIExtensionsImpl;
import org.eclipse.birt.chart.ui.swt.interfaces.IChartType;
import org.eclipse.birt.data.engine.api.DataEngine;
import org.eclipse.birt.data.engine.api.IBaseDataSetDesign;
import org.eclipse.birt.data.engine.api.IBaseDataSourceDesign;
import org.eclipse.birt.report.designer.core.model.SessionHandleAda pter;
import org.eclipse.birt.report.designer.internal.ui.dialogs.EngineA ccessor;
import org.eclipse.birt.report.designer.internal.ui.util.DataSetMan ager;
import org.eclipse.birt.report.engine.adapter.ModelDteApiAdapter;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.EngineConstants;
import org.eclipse.birt.report.engine.api.HTMLEmitterConfig;
import org.eclipse.birt.report.engine.api.HTMLRenderContext;
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.engine.api.IRunAndRenderTask;
import org.eclipse.birt.report.engine.api.ReportEngine;
import org.eclipse.birt.report.engine.api.impl.ReportEngineHelper;
import org.eclipse.birt.report.engine.i18n.EngineResourceHandle;
import org.eclipse.birt.report.engine.i18n.MessageConstants;
import org.eclipse.birt.report.model.api.DataSetHandle;
import org.eclipse.birt.report.model.api.DesignElementHandle;
import org.eclipse.birt.report.model.api.ExtendedItemHandle;
import org.eclipse.birt.report.model.api.ReportDesignHandle;
import org.eclipse.birt.report.model.api.ScriptDataSetHandle;
import org.eclipse.birt.report.model.api.ScriptDataSourceHandle;
import
org.eclipse.birt.report.model.api.elements.structures.Result SetColumn;
import org.eclipse.birt.report.model.api.extension.IReportItem;
import org.eclipse.birt.report.services.ReportEngineService;
import org.eclipse.core.runtime.Path;

public class GraphDesignerUtility {

/**
* Constant for extension name "Chart"
*/
private static final String EXTENSION_NAME_CHART = "Chart";

/**
* Constant for "400pt"
*/
private static final String _400PT = "400pt";

/**
* Constant for "250pt"
*/
private static final String _250PT = "250pt";

/**
* Constant for property "width"
*/
private static final String PROPERTY_WIDTH = "width";

/**
* Constant for property "height"
*/
private static final String PROPERTY_HEIGHT = "height";

/**
* Constant for property "chart.instance"
*/
private static final String PROPERTY_CHART_INSTANCE =
"chart.instance";

/**
* Constant for Inch ("in")
*/
private static final String INCH = "in";

/**
* Constant for property "units"
*/
private static final String PROPERTY_UNITS = "units";

/**
* Constant for empty rptdesign file name ("Empty.rptdesign")
which resides
* at project root.
*/
private static final String EMPTY_RPTDESIGN_FILE =
"Empty.rptdesign";

/**
* Reference to ReportDesignHandle
*/
private static ReportDesignHandle reportDesignHandle = null;

/**
* Reference to DataSetHandle Contains DataSet created from
swt-table.
*/
private static DataSetHandle dataSetHandle = null;

/**
* Specifies whether BIRT report engine is initialized properly.
*/
private static boolean isBIRTInitialized = false;

/**
* Returns reference to ReportDesignHandle.
*
* @return Reference to ReportDesignHandle
*/
public static ReportDesignHandle getReportDesignHandle() {
return reportDesignHandle;
}

/**
* Loads persisted report design file.
*
* @param fileName File name
*/
public static void openRptDesignFile(String fileName) {
try {
ReportDesignHandle rdh =
SessionHandleAdapter.getInstance()
.getSessionHandle().openDesign(fileName);


rdh.setProperty(GraphDesignerUtility.PROPERTY_UNITS,
GraphDesignerUtility.INCH);
reportDesignHandle = rdh;
} catch (Exception e) {
e.printStackTrace();;
}
}

/**
* Returns whether BIRT report engine is initialized properly.
*
* @return true, if report engine initialized properly else
returns false.
*/
public static boolean isBIRTInitialized() {
return isBIRTInitialized;
}

/**
* Initializes BIRT report engine.
*
* @return Whether BIRT report engine is initialized properly.
*/
public static boolean initializeBIRT() {
isBIRTInitialized = false;
try {
// Intialize ReportDesign
SessionHandleAdapter sessionHandleAdapter =
SessionHandleAdapter
.getInstance();
FileInputStream fin = (FileInputStream)
GraphsPlugin
.getDefault()
.openStream(
new
Path(GraphDesignerUtility.EMPTY_RPTDESIGN_FILE));
sessionHandleAdapter.init("", fin);

reportDesignHandle = (ReportDesignHandle)
sessionHandleAdapter
.getReportDesignHandle();

reportDesignHandle.setProperty(GraphDesignerUtility.PROPERTY _UNITS,
GraphDesignerUtility.INCH);
// Intialize DataSetManager

DataSetManager.setCurrentInstance(DataSetManager.newInstance ());

// Intialize DataSource
isBIRTInitialized = initializeDataSource();
} catch (Exception e) {
e.printStackTrace();;
}

return isBIRTInitialized;
}

/**
* Gets Chart from ReportDesign.
*
* @return Reference to Chart
*/
public static Chart getChart() {
Chart chart = null;
try {
ExtendedItemHandle eih = getExtendedItem();
if (eih != null) {
ChartReportItemImpl crii =
(ChartReportItemImpl) eih
.getReportItem();
chart = (Chart) crii

getProperty(GraphDesignerUtility.PROPERTY_CHART_INSTANCE);
}
} catch (Exception e) {
e.printStackTrace();;
}
return chart;
}

/**
* Sets Chart to ReportDesign.
*
* @param chart Reference to Chart
* @return Whether the Chart is set properly
*/
public static boolean setChart(Chart chart) {
try {
ExtendedItemHandle eih = getExtendedItem();
if (eih != null) {
ChartReportItemImpl crii =
(ChartReportItemImpl) eih
.getReportItem();

crii.setProperty(GraphDesignerUtility.PROPERTY_CHART_INSTANC E,
chart);
} else {
eih = newExtendedItem(chart);
}
if (eih != null) {
eih.setDataSet(dataSetHandle);
return true;
}
} catch (Exception e) {
e.printStackTrace();;
}
return false;
}

/**
* Returns ExtendedItem which is stored in ReportDesign.
*
* @return Reference to ExtendedItemHandle
*/
public static ExtendedItemHandle getExtendedItem() {
ExtendedItemHandle eih = null;
try {
if (reportDesignHandle != null) {
if
(reportDesignHandle.getBody().getCount() > 0) {
eih = (ExtendedItemHandle)
reportDesignHandle.getBody()
.get(0);
}
}
} catch (Exception e) {
e.printStackTrace();;
}
return eih;
}

/**
* Creates new ExtendedItem in ReportDesign for Chart.
*
* @param chart Reference to Chart
* @return Reference to ExtendedItemHandle
*/
private static ExtendedItemHandle newExtendedItem(Chart chart) {
ExtendedItemHandle eih = null;
try {
// Create new ExtendedItem for Chart
eih =
reportDesignHandle.getElementFactory().newExtendedItem(null,

GraphDesignerUtility.EXTENSION_NAME_CHART);

// Set chart to newly created ExtendedItem
IReportItem item = eih.getReportItem();
ChartReportItemImpl crii = (ChartReportItemImpl)
item;

crii.setProperty(GraphDesignerUtility.PROPERTY_CHART_INSTANC E,
chart);

eih.setDataSet(null);

// Set ExtendedItem properties

eih.setProperty(GraphDesignerUtility.PROPERTY_HEIGHT,
GraphDesignerUtility._250PT);

eih.setProperty(GraphDesignerUtility.PROPERTY_WIDTH,
GraphDesignerUtility._400PT);
eih.setProperty(ExtendedItemHandle.DATA_SET_PROP,
"Java UI table");

// Add newly created ExtendedItem to ReportDesign
if (reportDesignHandle.getBody().getCount() != 0) {
reportDesignHandle.getBody().drop(0);
}
reportDesignHandle.getBody().add(eih, 0);

} catch (Exception e) {
e.printStackTrace();;
eih = null;
}
return eih;
}

/**
* Initialize/Reinitialize DataSource used by ReportDesign.<br>
* 1. Creates new DataSource <br>
* 2. Intialize DataEngine with newly created DataSource
*
* @return Whether DataSource is initialized properly
*/
private static boolean initializeDataSource() {
try {
// Create new DataSource
ScriptDataSourceHandle dataSourceHandle =
DatasetUtility
.createScriptDataSource();
if (dataSourceHandle == null) {
return false;
}

// Intialize DataEngine with newly created
DataSource
IBaseDataSourceDesign dataSourceDesign =
ModelDteApiAdapter

getInstance().createDataSourceDesign(dataSourceHandle);
DataEngine dataEngine =
DataSetManager.getCurrentInstance()
.getEngine();
dataEngine.defineDataSource(dataSourceDesign);

return true;
} catch (Exception e) {
e.printStackTrace();;
return false;
}
}

/**
* Initialize/Reinitialize DataSet used by ReportDesign. <br>
* 1. Creates DataSet from swt-table <br>
* 2. Intialize DataEngine with newly created DataSet
*
* @return Whether DataSet is initialized properly
*/
public static boolean initializeDataSet() {
try {
// Create new DataSet
DataSetHandle scriptDataSetHandle = DatasetUtility
.createScriptDataSet();
if (scriptDataSetHandle == null) {
return false;
}

// Intialize DataEngine with newly created DataSet
IBaseDataSetDesign dataSetDesign =
ModelDteApiAdapter.getInstance()

createDataSetDesign(scriptDataSetHandle);
DataEngine dataEngine =
DataSetManager.getCurrentInstance()
.getEngine();
dataEngine.defineDataSet(dataSetDesign);

dataSetHandle = scriptDataSetHandle;

return true;
} catch (Exception e) {
e.printStackTrace();;
return false;
}
}

/**
* Executes ReportDesign to fill out data series based on series
queries
* which were set during default graph generation or by ChartDlg.
*
* @return Whether ReportDesign is executed properly
*/
public static boolean runReport() {
try {
String outputFormat =
HTMLRenderOption.OUTPUT_FORMAT_HTML;

ReportEngine reportEngine =
EngineAccessor.getInstance();
EngineConfig config = reportEngine.getConfig();

HTMLEmitterConfig hc = new HTMLEmitterConfig();
// HTMLCompleteImageHandler imageHandler = new
// HTMLCompleteImageHandler();
// hc.setImageHandler(imageHandler);
config.setEmitterConfiguration(outputFormat, hc);

// Open the report design.
IReportRunnable report = null;
ReportEngineHelper helper = new
ReportEngineHelper(reportEngine);
report =
helper.openReportDesign(getReportDesignHandle());
// helper.stopLogging();

IRunAndRenderTask task = reportEngine
.createRunAndRenderTask(report);
HTMLRenderOption options = new HTMLRenderOption();
options.setOutputFormat(outputFormat);

// setup the output encoding
// options.getOutputSetting( ).put(
HTMLRenderOption.URL_ENCODING, "utf-8" );


OutputStream oStream = new ByteArrayOutputStream();
options.setOutputStream(oStream);
task.setRenderOption(options);

HTMLRenderContext renderContext = new
HTMLRenderContext();
// renderContext.setImageDirectory("image");
//$NON-NLS-1$

// //BIRT 2.0M2
// HashMap contextMap = new HashMap();
// contextMap.put( HTMLRenderContext.CONTEXT_NAME,
renderContext );
// task.setContext(contextMap);

// //BIRT 2.0M3
HashMap appContext = new HashMap( );
appContext.put(
EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT,
renderContext );
appContext.put( DataEngine.DATASET_CACHE_OPTION,
Boolean.TRUE );
appContext.put(
EngineConstants.APPCONTEXT_CLASSLOADER_KEY,
ReportEngineService.class.getClassLoader());


task.setAppContext( appContext );


// task.setContext(renderContext);

// setup the locale
task.setLocale( Locale.getDefault() );

// Run the report.
task.run();

String strHTML = oStream.toString();
oStream.close();
// HashMap map = options.getOutputSetting();
// String str = (String) map.get("outputStream");
// System.out.println();

String strErrOnReport =
EngineResourceHandle.getInstance()

getMessage(MessageConstants.ERRORS_ON_REPORT_PAGE);
if (strHTML.contains(strErrOnReport)) {
// runReport failed.
return false;
} else {
return true;
}

} catch (Exception e) {
return false;
}
}


/**
* Turns off BIRT debug messages <br>
* (INFO, WARNING, FATAL ERROR messages and Stack trace).
*/
public static void turnOffBIRTDebugMessages() {
Logger logger = Logger.getLogger("org.eclipse.birt");
logger.setLevel(Level.OFF);
StreamHandler logStreamHandler = new StreamHandler();
logger.addHandler(logStreamHandler);
logger.setUseParentHandlers(false);

Handler[] handlers = logger.getHandlers();
if ((handlers != null) && (handlers.length > 0)) {
for (int i = 0; i < handlers.length; i++) {
handlers[i].close();
logger.removeHandler(handlers[i]);
}
}
}

/**
* Gets DataSetHandle.
*
* @return Reference to DataSetHandle
*/
public static DataSetHandle getDataSetHandle() {
return dataSetHandle;
}
}

Here is the flow that I am following to render the chart.
- Initialize BIRT by calling initializeBIRT() method. This loads the
empty.rptdesign file.
Here is the Empty.rptdesign
----------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!-- Written by Eclipse BIRT 1.0 -->
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3" id="1">
<property name="units">in</property>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<page-footer>
<text id="3">
<property name="contentType">html</property>
<text-property name="content"><![CDATA[<value-of>new
Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
</report>


- Then load the saved chart.rptdesign using openRptDesignFile() method.
- Then call the method to get the chart using getChart() method.


Please let me know if you require any other information.

Bharat
Re: Source value can not be null [message #115584 is a reply to message #115418] Wed, 25 January 2006 07:59 Go to previous messageGo to next message
Eclipse UserFriend
Thanks, I also need the DatasetUtility class and the PaintListener class.

Maybe can you try this: remove the line: Chart chartToRender = (Chart)
EcoreUtil.copy( chart );

I am not sure it will copy the Dataset, this might be the problem, but it's
nothing new to 2.0 though. Otherwise, I imagine you call runreport before
getting the chart?

Thanks,

David Michonneau
BIRT Committer


"Bharat Panchal" <bharat.panchal@patni.com> wrote in message
news:bed26280fa2f2020e273b2099ea4a188$1@www.eclipse.org...
> Hi David,
> Thanks for quick reply.
>
> Here is the code:
> import java.io.ByteArrayOutputStream;
> import java.io.FileInputStream;
> import java.io.OutputStream;
> import java.io.Reader;
> import java.io.StringReader;
> import java.util.ArrayList;
> import java.util.Collection;
> import java.util.HashMap;
> import java.util.Iterator;
> import java.util.Locale;
> import java.util.logging.Handler;
> import java.util.logging.Level;
> import java.util.logging.Logger;
> import java.util.logging.StreamHandler;
>
> import javax.swing.text.Document;
> import javax.swing.text.EditorKit;
> import javax.swing.text.html.HTMLEditorKit;
>
> import org.eclipse.birt.chart.model.Chart;
> import org.eclipse.birt.chart.reportitem.ChartReportItemImpl;
> import org.eclipse.birt.chart.ui.swt.UIExtensionsImpl;
> import org.eclipse.birt.chart.ui.swt.interfaces.IChartType;
> import org.eclipse.birt.data.engine.api.DataEngine;
> import org.eclipse.birt.data.engine.api.IBaseDataSetDesign;
> import org.eclipse.birt.data.engine.api.IBaseDataSourceDesign;
> import org.eclipse.birt.report.designer.core.model.SessionHandleAda pter;
> import
> org.eclipse.birt.report.designer.internal.ui.dialogs.EngineA ccessor;
> import org.eclipse.birt.report.designer.internal.ui.util.DataSetMan ager;
> import org.eclipse.birt.report.engine.adapter.ModelDteApiAdapter;
> import org.eclipse.birt.report.engine.api.EngineConfig;
> import org.eclipse.birt.report.engine.api.EngineConstants;
> import org.eclipse.birt.report.engine.api.HTMLEmitterConfig;
> import org.eclipse.birt.report.engine.api.HTMLRenderContext;
> import org.eclipse.birt.report.engine.api.HTMLRenderOption;
> import org.eclipse.birt.report.engine.api.IReportRunnable;
> import org.eclipse.birt.report.engine.api.IRunAndRenderTask;
> import org.eclipse.birt.report.engine.api.ReportEngine;
> import org.eclipse.birt.report.engine.api.impl.ReportEngineHelper;
> import org.eclipse.birt.report.engine.i18n.EngineResourceHandle;
> import org.eclipse.birt.report.engine.i18n.MessageConstants;
> import org.eclipse.birt.report.model.api.DataSetHandle;
> import org.eclipse.birt.report.model.api.DesignElementHandle;
> import org.eclipse.birt.report.model.api.ExtendedItemHandle;
> import org.eclipse.birt.report.model.api.ReportDesignHandle;
> import org.eclipse.birt.report.model.api.ScriptDataSetHandle;
> import org.eclipse.birt.report.model.api.ScriptDataSourceHandle;
> import
> org.eclipse.birt.report.model.api.elements.structures.Result SetColumn;
> import org.eclipse.birt.report.model.api.extension.IReportItem;
> import org.eclipse.birt.report.services.ReportEngineService;
> import org.eclipse.core.runtime.Path;
>
> public class GraphDesignerUtility {
>
> /**
> * Constant for extension name "Chart"
> */
> private static final String EXTENSION_NAME_CHART = "Chart";
>
> /**
> * Constant for "400pt"
> */
> private static final String _400PT = "400pt";
>
> /**
> * Constant for "250pt"
> */
> private static final String _250PT = "250pt";
>
> /**
> * Constant for property "width"
> */
> private static final String PROPERTY_WIDTH = "width";
>
> /**
> * Constant for property "height"
> */
> private static final String PROPERTY_HEIGHT = "height";
>
> /**
> * Constant for property "chart.instance"
> */
> private static final String PROPERTY_CHART_INSTANCE =
> "chart.instance";
>
> /**
> * Constant for Inch ("in")
> */
> private static final String INCH = "in";
>
> /**
> * Constant for property "units"
> */
> private static final String PROPERTY_UNITS = "units";
>
> /**
> * Constant for empty rptdesign file name ("Empty.rptdesign") which
> resides
> * at project root.
> */
> private static final String EMPTY_RPTDESIGN_FILE =
> "Empty.rptdesign";
>
> /**
> * Reference to ReportDesignHandle
> */
> private static ReportDesignHandle reportDesignHandle = null;
>
> /**
> * Reference to DataSetHandle Contains DataSet created from
> swt-table.
> */
> private static DataSetHandle dataSetHandle = null;
>
> /**
> * Specifies whether BIRT report engine is initialized properly.
> */
> private static boolean isBIRTInitialized = false;
> /**
> * Returns reference to ReportDesignHandle.
> * * @return Reference to ReportDesignHandle
> */
> public static ReportDesignHandle getReportDesignHandle() {
> return reportDesignHandle;
> }
>
> /**
> * Loads persisted report design file.
> * * @param fileName File name
> */
> public static void openRptDesignFile(String fileName) {
> try {
> ReportDesignHandle rdh =
> SessionHandleAdapter.getInstance()
> .getSessionHandle().openDesign(fileName);
>
>
> rdh.setProperty(GraphDesignerUtility.PROPERTY_UNITS,
> GraphDesignerUtility.INCH);
> reportDesignHandle = rdh;
> } catch (Exception e) {
> e.printStackTrace();; }
> }
> /**
> * Returns whether BIRT report engine is initialized properly.
> * * @return true, if report engine initialized properly else
> returns false.
> */
> public static boolean isBIRTInitialized() {
> return isBIRTInitialized;
> }
>
> /**
> * Initializes BIRT report engine.
> * * @return Whether BIRT report engine is initialized properly.
> */
> public static boolean initializeBIRT() {
> isBIRTInitialized = false;
> try {
> // Intialize ReportDesign
> SessionHandleAdapter sessionHandleAdapter =
> SessionHandleAdapter
> .getInstance();
> FileInputStream fin = (FileInputStream)
> GraphsPlugin
> .getDefault()
> .openStream(
> new
> Path(GraphDesignerUtility.EMPTY_RPTDESIGN_FILE));
> sessionHandleAdapter.init("", fin);
>
> reportDesignHandle = (ReportDesignHandle)
> sessionHandleAdapter
> .getReportDesignHandle();
>
> reportDesignHandle.setProperty(GraphDesignerUtility.PROPERTY _UNITS,
> GraphDesignerUtility.INCH);
> // Intialize DataSetManager
>
> DataSetManager.setCurrentInstance(DataSetManager.newInstance ());
>
> // Intialize DataSource
> isBIRTInitialized = initializeDataSource();
> } catch (Exception e) {
> e.printStackTrace();;
> }
>
> return isBIRTInitialized;
> }
>
> /**
> * Gets Chart from ReportDesign.
> * * @return Reference to Chart
> */
> public static Chart getChart() {
> Chart chart = null;
> try {
> ExtendedItemHandle eih = getExtendedItem();
> if (eih != null) {
> ChartReportItemImpl crii =
> (ChartReportItemImpl) eih
> .getReportItem();
> chart = (Chart) crii
>
> getProperty(GraphDesignerUtility.PROPERTY_CHART_INSTANCE);
> }
> } catch (Exception e) {
> e.printStackTrace();;
> }
> return chart;
> }
>
> /**
> * Sets Chart to ReportDesign.
> * * @param chart Reference to Chart
> * @return Whether the Chart is set properly
> */
> public static boolean setChart(Chart chart) {
> try {
> ExtendedItemHandle eih = getExtendedItem();
> if (eih != null) {
> ChartReportItemImpl crii =
> (ChartReportItemImpl) eih
> .getReportItem();
>
> crii.setProperty(GraphDesignerUtility.PROPERTY_CHART_INSTANC E,
> chart);
> } else {
> eih = newExtendedItem(chart);
> }
> if (eih != null) {
> eih.setDataSet(dataSetHandle);
> return true;
> }
> } catch (Exception e) {
> e.printStackTrace();;
> }
> return false;
> }
>
> /**
> * Returns ExtendedItem which is stored in ReportDesign.
> * * @return Reference to ExtendedItemHandle
> */
> public static ExtendedItemHandle getExtendedItem() {
> ExtendedItemHandle eih = null;
> try {
> if (reportDesignHandle != null) {
> if (reportDesignHandle.getBody().getCount()
> > 0) {
> eih = (ExtendedItemHandle)
> reportDesignHandle.getBody()
> .get(0);
> }
> }
> } catch (Exception e) {
> e.printStackTrace();;
> }
> return eih;
> }
>
> /**
> * Creates new ExtendedItem in ReportDesign for Chart.
> * * @param chart Reference to Chart
> * @return Reference to ExtendedItemHandle
> */
> private static ExtendedItemHandle newExtendedItem(Chart chart) {
> ExtendedItemHandle eih = null;
> try {
> // Create new ExtendedItem for Chart
> eih =
> reportDesignHandle.getElementFactory().newExtendedItem(null,
>
> GraphDesignerUtility.EXTENSION_NAME_CHART);
>
> // Set chart to newly created ExtendedItem
> IReportItem item = eih.getReportItem();
> ChartReportItemImpl crii = (ChartReportItemImpl)
> item;
>
> crii.setProperty(GraphDesignerUtility.PROPERTY_CHART_INSTANC E,
> chart);
>
> eih.setDataSet(null);
>
> // Set ExtendedItem properties
>
> eih.setProperty(GraphDesignerUtility.PROPERTY_HEIGHT,
> GraphDesignerUtility._250PT);
>
> eih.setProperty(GraphDesignerUtility.PROPERTY_WIDTH,
> GraphDesignerUtility._400PT);
> eih.setProperty(ExtendedItemHandle.DATA_SET_PROP,
> "Java UI table");
>
> // Add newly created ExtendedItem to ReportDesign
> if (reportDesignHandle.getBody().getCount() != 0) {
> reportDesignHandle.getBody().drop(0);
> }
> reportDesignHandle.getBody().add(eih, 0);
>
> } catch (Exception e) {
> e.printStackTrace();;
> eih = null;
> }
> return eih;
> }
>
> /**
> * Initialize/Reinitialize DataSource used by ReportDesign.<br> *
> 1. Creates new DataSource <br>
> * 2. Intialize DataEngine with newly created DataSource
> * * @return Whether DataSource is initialized properly
> */
> private static boolean initializeDataSource() {
> try {
> // Create new DataSource
> ScriptDataSourceHandle dataSourceHandle =
> DatasetUtility
> .createScriptDataSource();
> if (dataSourceHandle == null) {
> return false;
> }
>
> // Intialize DataEngine with newly created
> DataSource
> IBaseDataSourceDesign dataSourceDesign =
> ModelDteApiAdapter
>
> getInstance().createDataSourceDesign(dataSourceHandle);
> DataEngine dataEngine =
> DataSetManager.getCurrentInstance()
> .getEngine();
> dataEngine.defineDataSource(dataSourceDesign);
>
> return true;
> } catch (Exception e) {
> e.printStackTrace();;
> return false;
> }
> }
>
> /**
> * Initialize/Reinitialize DataSet used by ReportDesign. <br>
> * 1. Creates DataSet from swt-table <br>
> * 2. Intialize DataEngine with newly created DataSet
> * * @return Whether DataSet is initialized properly
> */
> public static boolean initializeDataSet() {
> try {
> // Create new DataSet
> DataSetHandle scriptDataSetHandle = DatasetUtility
> .createScriptDataSet();
> if (scriptDataSetHandle == null) {
> return false;
> }
>
> // Intialize DataEngine with newly created DataSet
> IBaseDataSetDesign dataSetDesign =
> ModelDteApiAdapter.getInstance()
>
> createDataSetDesign(scriptDataSetHandle);
> DataEngine dataEngine =
> DataSetManager.getCurrentInstance()
> .getEngine();
> dataEngine.defineDataSet(dataSetDesign);
>
> dataSetHandle = scriptDataSetHandle;
>
> return true;
> } catch (Exception e) {
> e.printStackTrace();;
> return false;
> }
> }
>
> /**
> * Executes ReportDesign to fill out data series based on series
> queries
> * which were set during default graph generation or by ChartDlg.
> * * @return Whether ReportDesign is executed properly
> */
> public static boolean runReport() {
> try {
> String outputFormat =
> HTMLRenderOption.OUTPUT_FORMAT_HTML;
>
> ReportEngine reportEngine =
> EngineAccessor.getInstance();
> EngineConfig config = reportEngine.getConfig();
>
> HTMLEmitterConfig hc = new HTMLEmitterConfig();
> // HTMLCompleteImageHandler imageHandler = new
> // HTMLCompleteImageHandler();
> // hc.setImageHandler(imageHandler);
> config.setEmitterConfiguration(outputFormat, hc);
>
> // Open the report design.
> IReportRunnable report = null;
> ReportEngineHelper helper = new
> ReportEngineHelper(reportEngine);
> report =
> helper.openReportDesign(getReportDesignHandle());
> // helper.stopLogging();
>
> IRunAndRenderTask task = reportEngine
> .createRunAndRenderTask(report);
> HTMLRenderOption options = new HTMLRenderOption();
> options.setOutputFormat(outputFormat);
> // setup the output encoding
> // options.getOutputSetting( ).put(
> HTMLRenderOption.URL_ENCODING, "utf-8" );
> OutputStream oStream = new ByteArrayOutputStream();
> options.setOutputStream(oStream);
> task.setRenderOption(options);
>
> HTMLRenderContext renderContext = new
> HTMLRenderContext();
> // renderContext.setImageDirectory("image");
> //$NON-NLS-1$
>
> // //BIRT 2.0M2
> // HashMap contextMap = new HashMap();
> // contextMap.put( HTMLRenderContext.CONTEXT_NAME,
> renderContext );
> // task.setContext(contextMap);
>
> // //BIRT 2.0M3
> HashMap appContext = new HashMap( );
> appContext.put(
> EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT,
> renderContext );
> appContext.put( DataEngine.DATASET_CACHE_OPTION,
> Boolean.TRUE );
> appContext.put(
> EngineConstants.APPCONTEXT_CLASSLOADER_KEY,
> ReportEngineService.class.getClassLoader());
> task.setAppContext( appContext );
> // task.setContext(renderContext);
> // setup the locale
> task.setLocale( Locale.getDefault() );
>
> // Run the report.
> task.run();
>
> String strHTML = oStream.toString();
> oStream.close();
> // HashMap map = options.getOutputSetting();
> // String str = (String) map.get("outputStream");
> // System.out.println();
>
> String strErrOnReport =
> EngineResourceHandle.getInstance()
>
> getMessage(MessageConstants.ERRORS_ON_REPORT_PAGE);
> if (strHTML.contains(strErrOnReport)) {
> // runReport failed.
> return false;
> } else {
> return true;
> }
>
> } catch (Exception e) {
> return false;
> }
> }
>
>
> /**
> * Turns off BIRT debug messages <br>
> * (INFO, WARNING, FATAL ERROR messages and Stack trace).
> */
> public static void turnOffBIRTDebugMessages() {
> Logger logger = Logger.getLogger("org.eclipse.birt");
> logger.setLevel(Level.OFF);
> StreamHandler logStreamHandler = new StreamHandler();
> logger.addHandler(logStreamHandler);
> logger.setUseParentHandlers(false);
>
> Handler[] handlers = logger.getHandlers();
> if ((handlers != null) && (handlers.length > 0)) {
> for (int i = 0; i < handlers.length; i++) {
> handlers[i].close();
> logger.removeHandler(handlers[i]);
> }
> }
> }
>
> /**
> * Gets DataSetHandle.
> * * @return Reference to DataSetHandle
> */
> public static DataSetHandle getDataSetHandle() {
> return dataSetHandle;
> } }
>
> Here is the flow that I am following to render the chart.
> - Initialize BIRT by calling initializeBIRT() method. This loads the
> empty.rptdesign file.
> Here is the Empty.rptdesign
> ----------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- Written by Eclipse BIRT 1.0 -->
> <report xmlns="http://www.eclipse.org/birt/2005/design" version="3"
> id="1">
> <property name="units">in</property>
> <page-setup>
> <simple-master-page name="Simple MasterPage" id="2">
> <page-footer>
> <text id="3">
> <property name="contentType">html</property>
> <text-property name="content"><![CDATA[<value-of>new
> Date()</value-of>]]></text-property>
> </text>
> </page-footer>
> </simple-master-page>
> </page-setup>
> </report>
>
>
> - Then load the saved chart.rptdesign using openRptDesignFile() method.
> - Then call the method to get the chart using getChart() method.
>
>
> Please let me know if you require any other information.
>
> Bharat
>
Re: Source value can not be null [message #115664 is a reply to message #115584] Wed, 25 January 2006 09:03 Go to previous messageGo to next message
Eclipse UserFriend
DataSetUtility.java
--------------------
import java.text.NumberFormat;
import java.util.Locale;

import org.eclipse.birt.report.model.api.PropertyHandle;
import org.eclipse.birt.report.model.api.ReportDesignHandle;
import org.eclipse.birt.report.model.api.ScriptDataSetHandle;
import org.eclipse.birt.report.model.api.ScriptDataSourceHandle;
import org.eclipse.birt.report.model.api.StructureFactory;
import org.eclipse.birt.report.model.api.activity.SemanticException ;
import org.eclipse.birt.report.model.api.elements.structures.Column Hint;
import
org.eclipse.birt.report.model.api.elements.structures.Result SetColumn;
import org.eclipse.swt.widgets.TableItem;

/**
* This class is used to create scripted data source and dataset.
*
*/
public class DatasetUtility {

/**
* Constant for positive(+) sign.
*/
private static final String POSITIVE_SIGN = "+";

/**
* Constant for negative(-) sign.
*/
private static final String NEGATIVE_SIGN = "-";

/**
* Creates scripted data source.
*
* @return Scripted data source handle
*/
public static ScriptDataSourceHandle createScriptDataSource() {
try {
ReportDesignHandle reportDesignHandle =
GraphDesignerUtility.getReportDesignHandle();
if (reportDesignHandle.getDataSources().getCount() > 0) {
reportDesignHandle.getDataSources().drop(0);
}
ScriptDataSourceHandle dataSourceHandle = reportDesignHandle.
getElementFactory().
newScriptDataSource(GraphConstants.DATA_SOURCE_NAME);
reportDesignHandle.getDataSources().add(dataSourceHandle);
return dataSourceHandle;
} catch (Exception e) {
GraphUtility.debug(e);
return null;
}
}

/**
* Creates scripted dataset and sets corresponding code to its
* javascript methods.
*
* @return Scripted dataset handle
*/
public static ScriptDataSetHandle createScriptDataSet() {
try {
ReportDesignHandle reportDesignHandle = GraphDesignerUtility
.getReportDesignHandle();

//Java UI table
if (reportDesignHandle.getDataSets().getCount() > 0) {
reportDesignHandle.getDataSets().drop(0);
}
ScriptDataSetHandle dataSetHandle = reportDesignHandle.
getElementFactory().
newScriptDataSet(GraphConstants.DATASET_NAME);
dataSetHandle.setDataSource(GraphConstants.DATA_SOURCE_NAME) ;

//Set open( ) in code
dataSetHandle.setOpen(getOpenMethodCode());

//Set fetch( ) in code
dataSetHandle.setFetch(getFetchMethodCode());

//Set Output Columns in Java UI table
PropertyHandle columnHint = dataSetHandle
.getPropertyHandle(ScriptDataSetHandle.COLUMN_HINTS_PROP);
setOutputColumnsInDataSet(columnHint);

PropertyHandle resultSet = dataSetHandle
.getPropertyHandle(ScriptDataSetHandle.RESULT_SET_PROP);
setPreviewResultsColumnsInDataSet(resultSet);

reportDesignHandle.getDataSets().add(dataSetHandle);

return dataSetHandle;
} catch (Exception e) {
GraphUtility.debug(e);
return null;
}
}

/**
* Generates javascript code for open method of scripted dataset.
* It iterates thru all table rows and generates the code.
*
* @return Javascript code for open method
*/
private static String getOpenMethodCode(){
TableWrapper tableWrapper = GraphView.getTableWrapper();
boolean[] visibleProp = tableWrapper.getVisiblePropertyofColumns();
boolean[] numericProp = tableWrapper.getNumericPropertyofColumns();

StringBuffer sb = new StringBuffer("i=0;");
sb.append("sourcedata = new Array( ");
int visibleColumnCount = tableWrapper.getVisibleColumnCount();
TableItem[] tableItems = tableWrapper.getTableItems();
int tableItemCount = tableItems.length;
for(int i=0; i<tableItemCount-1; i++){
sb.append("new Array(");
sb.append(visibleColumnCount);
sb.append("), ");
}
sb.append("new Array("+visibleColumnCount+")");
sb.append(");");

for(int i=0; i<tableItemCount;i++){
for(int j=0,columnIndex=0; j<visibleProp.length; j++){
if (visibleProp[j]) {
sb.append("sourcedata[");
sb.append(i);
sb.append("][");
sb.append(columnIndex++);

String value = tableItems[i].getText(j).trim();
if (numericProp[j]) {
value = ""+toDouble(value);
sb.append("]= ");
sb.append(value);
sb.append(";");
} else {
sb.append("]= \"");
sb.append(value);
sb.append("\";");
}
}
}
}
// GraphUtility.debug("open = "+sb.toString());
return sb.toString();
}

/**
* Generates javascript code for fetch method of scripted dataset.
*
* @return Javascript code for fetch method
*/
private static String getFetchMethodCode(){
TableWrapper tableWrapper = GraphView.getTableWrapper();
boolean[] visibleProp = tableWrapper.getVisiblePropertyofColumns();

StringBuffer sb = new StringBuffer();

sb.append("if (i< ");
sb.append(tableWrapper.getTableRowCount());
sb.append("){");
for(int i=0,columnIndex=0; i<visibleProp.length; i++){
if (visibleProp[i]) {
sb.append(GraphUtility.generateQueryString(i));
sb.append(" = sourcedata[i][");
sb.append(columnIndex++);
sb.append("];");
}
}

sb.append("i++; ");
sb.append("return true;");
sb.append("} else return false;");
// GraphUtility.debug("fetch = "+sb.toString());
return sb.toString();
}

/**
* Sets columns which are to be displayed while chart customization.
*
* @param columnHint columnHint object
* @throws SemanticException
*/
private static void setOutputColumnsInDataSet(PropertyHandle columnHint)
throws SemanticException {
boolean[] visibleProp = GraphView.getTableWrapper()
.getVisiblePropertyofColumns();

for (int i = 0; i < visibleProp.length; i++) {
if (visibleProp[i]) {
ColumnHint ch = StructureFactory.createColumnHint();
ch.setProperty("columnName", GraphView.getTableWrapper()
.getColumnNameInDataset()[i]);
columnHint.addItem(ch);
}
}
}

/**
* Sets columns which are to be displayed while chart preview.
* Ouput of this method can only be seen when rptdesign file is persisted
* and opened in report designer.
*
* @param resultSet resultset object
* @throws SemanticException
*/
private static void setPreviewResultsColumnsInDataSet(
PropertyHandle resultSet) throws SemanticException {
boolean[] visibleProp = GraphView.getTableWrapper()
.getVisiblePropertyofColumns();

for (int i = 0; i < visibleProp.length; i++) {
if (visibleProp[i]) {
ResultSetColumn rs = StructureFactory.createResultSetColumn();
rs.setColumnName(GraphView.getTableWrapper()
.getColumnNameInDataset()[i]);
rs.setPosition(new Integer(i));

if (GraphView.getTableWrapper().getNumericPropertyofColumns()[i ]) {
rs.setDataType("Decimal");
} else {
rs.setDataType("String");
}
resultSet.addItem(rs);
}
}
}

/**
* Converts given number string to double.
*
* @param strNumber number string
* @return double value of input string, 0 if not able to convert.
*/
private static double toDouble(String strNumber) {
try {
NumberFormat nf = NumberFormat.getInstance(Locale.getDefault());

//If string ends with negative sign then concatenate negative
//sign and string. Becuase number format parser doesn't
//consider 15- as -15.
if(strNumber.startsWith(DatasetUtility.NEGATIVE_SIGN)){

}else if(strNumber.endsWith(DatasetUtility.NEGATIVE_SIGN)){
strNumber = DatasetUtility.NEGATIVE_SIGN+strNumber;
}

//If string contains positive sign then remove it,
//as number format parset doesn't consider +15 as 15.
if(strNumber.contains(DatasetUtility.POSITIVE_SIGN)){
strNumber = strNumber.replace(DatasetUtility.POSITIVE_SIGN,"");
}

return nf.parse(strNumber).doubleValue();
} catch (Exception e) {
return 0;
}
}

}
************************************************************


GarphPaintListener.java
------------------------

import org.eclipse.birt.chart.device.IDeviceRenderer;
import org.eclipse.birt.chart.factory.GeneratedChartState;
import org.eclipse.birt.chart.factory.Generator;
import org.eclipse.birt.chart.model.Chart;
import org.eclipse.birt.chart.model.attribute.Bounds;
import org.eclipse.birt.chart.model.attribute.impl.BoundsImpl;
import org.eclipse.birt.chart.util.PluginSettings;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.mozilla.javascript.Scriptable;

/**
* This class implements PaintListener interface and deals with the events
that
* are generated when the GraphView needs to be painted.
*
* @author panchalb
*
*/
public class GraphPaintListener implements PaintListener {

/**
* Reference of graph view.
*/
private GraphView graphView;

/**
* Reference of last valid Chart which can be rendered properly. <br>
* When any exception occurs during rendering of Chart, Graph view will be
* displayed with preserved chart.
*/
private Chart preservedValidChart = null;

/**
* Constructor.
* <p>
* GraphView will create object of this class using this constructor.
* @param view graph view
*/
public GraphPaintListener(GraphView view) {
this.graphView = view;
}

/**
* Sent when a paint event occurs for the control.
*
* @param e an event containing information about the paint
*/
public void paintControl(PaintEvent e) {
Chart chart = null;
try {
// Get chart from ReportDesign
chart = GraphDesignerUtility.getChart();
if (chart == null) {
// No chart available to render
graphView.updateActionState();
}
else {
// Create copy of chart which will be used for rendering
Chart chartToRender = (Chart) EcoreUtil.copy( chart );
// chart = (Chart) EcoreUtil.copy( chart );

// Get a SWT device renderer
IDeviceRenderer deviceRenderer = null;
deviceRenderer = PluginSettings.instance().getDevice("dv.SWT");
deviceRenderer.setProperty(IDeviceRenderer.GRAPHICS_CONTEXT, e.gc);
//Make sure we stay in the client area's bounds
Rectangle rect = ((Composite) e.widget).getClientArea();

final Bounds bounds = BoundsImpl.create(rect.x + 2, rect.y + 2,
rect.width - 4, rect.height - 4);
bounds.scale(72d / deviceRenderer.getDisplayServer()
.getDpiResolution());

final Generator gr = Generator.instance();
GeneratedChartState state;
// state = gr.build(deviceRenderer.getDisplayServer(), chart,
// (Scriptable) null, bounds, null);
state = gr.build(deviceRenderer.getDisplayServer(), chartToRender,
(Scriptable) null, bounds, null);
gr.render(deviceRenderer, state);
}
preservedValidChart = chart;
} catch (Exception ex) {
// When there is a problem in rendering chart, we set preserved
// chart as current chart but if rendering of preserved chart also
// fails, we set null as preserved and current chart.
// if (chart == preservedValidChart) {
// preservedValidChart = null;
// }
// GraphDesignerUtility.setChart(preservedValidChart);
// IBSGraphsPlugin.getDefault().displayError(
// GraphConstants.DEFAULT_ERROR_MESSAGE +
// GraphConstants.NEW_LINE + GraphConstants.NEW_LINE +
// ex.getMessage());
GraphUtility.debug(ex);
// graphView.refresh();
}

}

}


*******************************************************
I tried commenting Chart chartToRender = (Chart) EcoreUtil.copy( chart );
but not working.

I am also calling runReport before rendering the chart. Still its not
working.


Thanks.
Bharat
Re: Source value can not be null [message #115703 is a reply to message #115664] Wed, 25 January 2006 09:30 Go to previous messageGo to next message
Eclipse UserFriend
> I tried commenting Chart chartToRender = (Chart) EcoreUtil.copy( chart );
> but not working.
>
> I am also calling runReport before rendering the chart. Still its not
> working.

Do you mean you were not calling before, and it was working in 2.0RC? I need
to understand how you bind the data to the chart, so far I only see you
extract the chart from the report design. I wonder how you bind the data: I
thought you had BIRT doing for you when calling runreport. If not, then how
and where is it done?

>
>
> Thanks.
> Bharat
>
>
Re: Source value can not be null [message #116162 is a reply to message #115703] Wed, 25 January 2006 11:50 Go to previous messageGo to next message
Eclipse UserFriend
What I do is,
Get the chart by loading chart.rptdesign file.
It will create proper series for X and Y axis.
Then I call the runReport method, which binds the data with chart.
BIRT internally binds the data with chart.

I tried to display series for X and Y axis.

BIRT 2.0M3 output:
************************
Before calling runReport
-------------------------
X series definition contains row["x_series"]
Data set: null

Y series definition contains row["y_series"]
Data set: null

After calling runReport
-------------------------
X series definition contains row["x_series"]
Data set: null
X series definition contains row["x_series"]
Data set: Java_UI_Table_DATA_SET

Y series definition contains row["y_series"]
Data set: null
Y series definition contains row["y_series"]
Data set: Java_UI_Table_DATA_SET


BIRT 2.0RC or 2.0.0 version output:
**************************************

Before calling runReport
-------------------------
X series definition contains row["x_series"]
Data set: null

After calling runReport
-------------------------
X series definition contains row["x_series"]
Data set: null

BIRT was generating another series with same name was setting data set
with chart in 2.0M3, after calling runReport.
But not doing the same in 2.0.0 version. And that creates the problem.
Re: Source value can not be null [message #116224 is a reply to message #116162] Wed, 25 January 2006 13:13 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

We're looking into that issue, I will send you an update as soon as we
figure out what is wrong. I guess there is a copy being done somewhere, but
I did not find where yet. Make sure your code doesn't do any chart copy,
even the EMF deep copy might loose the dataset.

Thanks,

David

"Bharat Panchal" <bharat.panchal@patni.com> wrote in message
news:0d9e868ed8aa2a96939e88e72906f24f$1@www.eclipse.org...
> What I do is,
> Get the chart by loading chart.rptdesign file.
> It will create proper series for X and Y axis.
> Then I call the runReport method, which binds the data with chart.
> BIRT internally binds the data with chart.
>
> I tried to display series for X and Y axis.
>
> BIRT 2.0M3 output: ************************
> Before calling runReport
> -------------------------
> X series definition contains row["x_series"]
> Data set: null
>
> Y series definition contains row["y_series"]
> Data set: null
>
> After calling runReport
> -------------------------
> X series definition contains row["x_series"]
> Data set: null
> X series definition contains row["x_series"]
> Data set: Java_UI_Table_DATA_SET
>
> Y series definition contains row["y_series"]
> Data set: null
> Y series definition contains row["y_series"]
> Data set: Java_UI_Table_DATA_SET
>
>
> BIRT 2.0RC or 2.0.0 version output: **************************************
>
> Before calling runReport
> -------------------------
> X series definition contains row["x_series"]
> Data set: null
>
> After calling runReport
> -------------------------
> X series definition contains row["x_series"]
> Data set: null
>
> BIRT was generating another series with same name was setting data set
> with chart in 2.0M3, after calling runReport. But not doing the same in
> 2.0.0 version. And that creates the problem.
>
>
>
Re: Source value can not be null [message #116724 is a reply to message #116162] Wed, 25 January 2006 14:43 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I think I found the problem. This is due to the new engine architecture, but
it might well be a bug in fact. What happens is that the report is now
created in two steps: generation and presentation (that can occur at
different machines at different times). The data generated at generation
time is deserialized during presentation for further processing. In the case
of chart, the chart instance is deserialized, resulting in a new instance of
the chart, which is the one that is bound to the data. The original one in
the report design handle is not modifed, that's why it is still empty. You
can file a bugzilla entry for this issue.

In the meantime, I think one solution is to use scripting in java: that
would allow you to get a hook on the runtime chart instance while the report
is rendered. For this you have to implement
ChartEventHandlerAdapter.afterDataSetFilled and modify you report design to
register your event handler class in the chart (property editor view/event
handler). Then when you run the report, it will instantiate your event
handler and call the method afterDataSetFilled. In there you can get the
chart instance from the IChartScriptContext and pass it to one of your class
(maybe make one of them a singleton for that purpose). Then you can retrieve
the chart from there later on. I know this is not ideal, but I didn't see a
better solution so far.

Thanks,

David

"Bharat Panchal" <bharat.panchal@patni.com> wrote in message
news:0d9e868ed8aa2a96939e88e72906f24f$1@www.eclipse.org...
> What I do is,
> Get the chart by loading chart.rptdesign file.
> It will create proper series for X and Y axis.
> Then I call the runReport method, which binds the data with chart.
> BIRT internally binds the data with chart.
>
> I tried to display series for X and Y axis.
>
> BIRT 2.0M3 output: ************************
> Before calling runReport
> -------------------------
> X series definition contains row["x_series"]
> Data set: null
>
> Y series definition contains row["y_series"]
> Data set: null
>
> After calling runReport
> -------------------------
> X series definition contains row["x_series"]
> Data set: null
> X series definition contains row["x_series"]
> Data set: Java_UI_Table_DATA_SET
>
> Y series definition contains row["y_series"]
> Data set: null
> Y series definition contains row["y_series"]
> Data set: Java_UI_Table_DATA_SET
>
>
> BIRT 2.0RC or 2.0.0 version output: **************************************
>
> Before calling runReport
> -------------------------
> X series definition contains row["x_series"]
> Data set: null
>
> After calling runReport
> -------------------------
> X series definition contains row["x_series"]
> Data set: null
>
> BIRT was generating another series with same name was setting data set
> with chart in 2.0M3, after calling runReport. But not doing the same in
> 2.0.0 version. And that creates the problem.
>
>
>
Re: Source value can not be null [message #118373 is a reply to message #116724] Fri, 27 January 2006 01:44 Go to previous messageGo to next message
Eclipse UserFriend
Hi.
Thanks for looking into the problem in detail.

If the problem is really a bug, then I will file a bug for the same.

I'll try to use scripting in java as per your suggestion.

One more thing I would like to focus here is:

The chart is not able to render on canvas.But when I open the chart dialog
at runtime using folowing code, i am able to see all the series and
dataset bound to the chart. And it renders perfectly in Chart preview area.

Can you please let me know why the chart dialog is able to render the
chart in Chart Preview area and not able to render in our application?

-------------------------------------
Code that I am using for opening chart dialog
-------------------------------------
public void run() {
Chart chart = null;
try {
//chart = (Chart)
EcoreUtil.copy(GraphDesignerUtility.getChart());
//It makes no difference whether you copy the chart or not.
chart = GraphDesignerUtility.getChart();

ExtendedItemHandle eih =
GraphDesignerUtility.getExtendedItem();
if (eih != null) {
// get report item builder from extended element
IReportItemBuilderUI reportItemBuilder =
ExtensionPointManager

getInstance().getExtendedElementPoint(

eih.getExtensionName())
.getReportItemBuilderUI();
if (reportItemBuilder == null) {
// Report item builder is not found.
System.out.println("Report item builder
not found for "
+ eih.getExtensionName());
} else {
// Open the builder
int status = reportItemBuilder.open(eih);
if (status != Window.CANCEL) {
//If user has updated dataset then
rollback it
//and set default dataset.
if (eih.getDataSet() == null) {

eih.setDataSet(GraphDesignerUtility

getDataSetHandle());
}

//Verify if any of the data
definition is empty.
//User may have cleared or made
the data definition empty.
if (GraphUtility

isDataDefinitionEmpty(GraphDesignerUtility

getChart())) {
if
(!GraphDesignerUtility.runReport()) {
// runReport failed

GraphDesignerUtility.setChart(chart);
}
} else {

GraphDesignerUtility.setChart(chart);

System.out.println("DATA_DEFINITION_SHOULD_NOT_BE_EMPTY");
}
graphView.refresh();
}
}
}
} catch (Exception e) {
GraphDesignerUtility.setChart(chart);
GraphUtility.debug(e);
}
}

Thanks.
Re: Source value can not be null [message #118522 is a reply to message #118373] Fri, 27 January 2006 06:37 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

The Chart dialog can take a chart design instance (not filled with data) as
input. It will internally bind it to data and display it. So that's why it's
working. In your application you're getting a chart design instance as well,
but the chart engine will not try to bind it with data, if you don't ask for
it. In your scenario you expect the report to bind data when it runs, and
that's the bug we discussed about, the bound instance cannot be retrieved
afterwards.

The chart dialog can do this databinding by itself without running the
report. You might wonder if you can do the same thing, it's certainly
possible but there are some limitations:
1- If you bind data outside the report, you can't have data that is
dependent on report runtime expressions such as report parameters(params),
report configuration(config), etc...
2- You cannot use the external context in your chart script if you have any,
since there won't be any report context available.

If you're still interested in this way of doing things that avoids running
the report to bind and render the chart, I can provide more guidance, let me
know.

Thanks,

David


"Bharat Panchal" <bharat.panchal@patni.com> wrote in message
news:11388c9c9b69678a2b48eb168541bf54$1@www.eclipse.org...
> Hi.
> Thanks for looking into the problem in detail.
>
> If the problem is really a bug, then I will file a bug for the same.
>
> I'll try to use scripting in java as per your suggestion.
>
> One more thing I would like to focus here is:
>
> The chart is not able to render on canvas.But when I open the chart dialog
> at runtime using folowing code, i am able to see all the series and
> dataset bound to the chart. And it renders perfectly in Chart preview
> area.
>
> Can you please let me know why the chart dialog is able to render the
> chart in Chart Preview area and not able to render in our application?
>
> -------------------------------------
> Code that I am using for opening chart dialog
> -------------------------------------
> public void run() {
> Chart chart = null;
> try {
> //chart = (Chart)
> EcoreUtil.copy(GraphDesignerUtility.getChart());
> //It makes no difference whether you copy the chart or not.
> chart = GraphDesignerUtility.getChart();
>
> ExtendedItemHandle eih =
> GraphDesignerUtility.getExtendedItem();
> if (eih != null) {
> // get report item builder from extended element
> IReportItemBuilderUI reportItemBuilder =
> ExtensionPointManager
>
> getInstance().getExtendedElementPoint(
>
> eih.getExtensionName())
> .getReportItemBuilderUI();
> if (reportItemBuilder == null) {
> // Report item builder is not found.
> System.out.println("Report item builder not
> found for "
> + eih.getExtensionName());
> } else {
> // Open the builder
> int status = reportItemBuilder.open(eih);
> if (status != Window.CANCEL) {
> //If user has updated dataset then
> rollback it
> //and set default dataset.
> if (eih.getDataSet() == null) {
>
> eih.setDataSet(GraphDesignerUtility
>
> getDataSetHandle());
> }
>
> //Verify if any of the data
> definition is empty.
> //User may have cleared or made the
> data definition empty. if (GraphUtility
>
> isDataDefinitionEmpty(GraphDesignerUtility
>
> getChart())) {
> if
> (!GraphDesignerUtility.runReport()) {
> // runReport failed
>
> GraphDesignerUtility.setChart(chart);
> }
> } else {
>
> GraphDesignerUtility.setChart(chart);
>
> System.out.println("DATA_DEFINITION_SHOULD_NOT_BE_EMPTY");
> }
> graphView.refresh();
> }
> }
> }
> } catch (Exception e) {
> GraphDesignerUtility.setChart(chart);
> GraphUtility.debug(e);
> }
> }
>
> Thanks.
>
Re: Source value can not be null [message #118536 is a reply to message #118522] Fri, 27 January 2006 06:58 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
Thanks for reply.

At present my application doesn't need any runtime expressions or external
context.
So it would be nice if you can provide more guidance on binding data
without running report.

BTW, As per your suggestion, I created one public class GraphEventHandler
which extends ChartEventHandlerAdapter class by overriding
afterDataSetFilled method.
I had also set the eventHandlerClass property for chart.

I put this class in
org.eclipse.birt.report.viewer_2.0.0\birt\WEB-INF\classes folder.
But when I try to load the application, I get class "GraphEventHandler"
not found exception.
So where should I put the class?

Thanks.
Re: Source value can not be null [message #118694 is a reply to message #118536] Fri, 27 January 2006 08:52 Go to previous messageGo to next message
Eclipse UserFriend
Did you put the full qualified name of the class in the chart property? i.e.
com.yourpackage.GraphEventHandler?

You can put the class in your workspace. If outside Eclipse, you could try
putting it in the same folder as the report design, I will check on that and
get back to you.

Thanks,

David

"Bharat Panchal" <bharat.panchal@patni.com> wrote in message
news:e8b12256a9ace2b13ca04e98a8c69318$1@www.eclipse.org...
> Hi,
> Thanks for reply.
>
> At present my application doesn't need any runtime expressions or external
> context.
> So it would be nice if you can provide more guidance on binding data
> without running report.
>
> BTW, As per your suggestion, I created one public class GraphEventHandler
> which extends ChartEventHandlerAdapter class by overriding
> afterDataSetFilled method.
> I had also set the eventHandlerClass property for chart.
>
> I put this class in
> org.eclipse.birt.report.viewer_2.0.0\birt\WEB-INF\classes folder.
> But when I try to load the application, I get class "GraphEventHandler"
> not found exception. So where should I put the class?
>
> Thanks.
>
>
Re: Source value can not be null [message #118760 is a reply to message #118694] Fri, 27 January 2006 09:23 Go to previous messageGo to next message
Eclipse UserFriend
Thank you David.

I put the full qualified name of the class in the chart property and put
the class in WEB-INF/classes directory with appropriate package structure.

I restarted eclipse. I think (but I'm not sure) it is able to find the
class now.
But this event handler class is not coming in picture. I have put some
println statements in it, which are not being called while running report.

I don't understand what is going wrong.
I get exception like:

org.eclipse.birt.report.engine.api.EngineException:
There are problems(s) generating extended item Chart. at
org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .generateContent(ExtendedItemExecutor.java:142)
at
org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .execute(ExtendedItemExecutor.java:90)
at
org.eclipse.birt.report.engine.executor.ReportExecutorVisito r.visitExtendedItem(ReportExecutorVisitor.java:81)
at
org.eclipse.birt.report.engine.ir.ExtendedItemDesign.accept( ExtendedItemDesign.java:30)
at
org.eclipse.birt.report.engine.executor.ReportExecutor.execu te(ReportExecutor.java:125)
at
org.eclipse.birt.report.engine.executor.ReportExecutor.execu te(ReportExecutor.java:89)
at
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRenderTask.java:175)
at
graphs.graph.utility.GraphDesignerUtility.runReport(GraphDes ignerUtility.java:469)
and more...

Please guide me.

Thanks.
Re: Source value can not be null [message #118797 is a reply to message #118760] Fri, 27 January 2006 09:27 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I am not sure your println will do anything. Can you show more of the
exception message? I got my example working. I'm posting it here:
package mypackage;

import org.eclipse.birt.chart.model.component.Label;
import org.eclipse.birt.chart.model.component.Series;
import org.eclipse.birt.chart.script.ChartEventHandlerAdapter;
import org.eclipse.birt.chart.script.IChartScriptContext;

public class myhandler extends ChartEventHandlerAdapter
{

public void beforeDrawSeriesTitle( Series se, Label la, IChartScriptContext
ce )
{
la.getCaption().setValue("my script title");

}

}

Try it with a pie chart, it's going to set the title of each series to "my
script title".

Thanks,

David

"Bharat Panchal" <bharat.panchal@patni.com> wrote in message
news:25a1ab2b85f9c2d16808b405da8ec370$1@www.eclipse.org...
> Thank you David.
>
> I put the full qualified name of the class in the chart property and put
> the class in WEB-INF/classes directory with appropriate package
> structure.
>
> I restarted eclipse. I think (but I'm not sure) it is able to find the
> class now.
> But this event handler class is not coming in picture. I have put some
> println statements in it, which are not being called while running report.
>
> I don't understand what is going wrong.
> I get exception like:
>
> org.eclipse.birt.report.engine.api.EngineException: There are problems(s)
> generating extended item Chart. at
> org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .generateContent(ExtendedItemExecutor.java:142)
> at
> org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .execute(ExtendedItemExecutor.java:90)
> at
> org.eclipse.birt.report.engine.executor.ReportExecutorVisito r.visitExtendedItem(ReportExecutorVisitor.java:81)
> at
> org.eclipse.birt.report.engine.ir.ExtendedItemDesign.accept( ExtendedItemDesign.java:30)
> at
> org.eclipse.birt.report.engine.executor.ReportExecutor.execu te(ReportExecutor.java:125)
> at
> org.eclipse.birt.report.engine.executor.ReportExecutor.execu te(ReportExecutor.java:89)
> at
> org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRenderTask.java:175)
> at
> graphs.graph.utility.GraphDesignerUtility.runReport(GraphDes ignerUtility.java:469)
> and more...
>
> Please guide me.
>
> Thanks.
>
>
>
>
Re: Source value can not be null [message #118810 is a reply to message #118797] Fri, 27 January 2006 09:36 Go to previous messageGo to next message
Eclipse UserFriend
Here is the stact trace of exception:


org.eclipse.birt.report.engine.api.EngineException:
There are problems(s) generating extended item Chart. at
org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .generateContent(ExtendedItemExecutor.java:142)
at
org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .execute(ExtendedItemExecutor.java:90)
at
org.eclipse.birt.report.engine.executor.ReportExecutorVisito r.visitExtendedItem(ReportExecutorVisitor.java:81)
at
org.eclipse.birt.report.engine.ir.ExtendedItemDesign.accept( ExtendedItemDesign.java:30)
at
org.eclipse.birt.report.engine.executor.ReportExecutor.execu te(ReportExecutor.java:125)
at
org.eclipse.birt.report.engine.executor.ReportExecutor.execu te(ReportExecutor.java:89)
at
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRenderTask.java:175)
at
graphs.graph.utility.GraphDesignerUtility.runReport(GraphDes ignerUtility.java:469)
at
graphs.graph.generator.DefaultGraphGenerator.generateDefault Graph(DefaultGraphGenerator.java:124)
at
graphs.views.GraphView.showGraph(GraphView.java:252) at
graphs.graph.UpdateGraphAction.runWithEvent(UpdateGraphActio n.java:57) at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:538)
at
org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:488)
at
org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:400)
at
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66) at
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843) at
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3080) at
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2713) at
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1699) at
org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663) at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:367)
at
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:143) at
net..ui.client.JavaClient.run(JavaClient.java:29) at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:226)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:376)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:163)
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at
java.lang.reflect.Method.invoke(Unknown Source) at
org.eclipse.core.launcher.Main.invokeFramework(Main.java:334 ) at
org.eclipse.core.launcher.Main.basicRun(Main.java:278) at
org.eclipse.core.launcher.Main.run(Main.java:973) at
org.eclipse.core.launcher.Main.main(Main.java:948) Caused by:
org.eclipse.birt.chart.exception.ChartException: $NO-RB$ ReferenceError:
"graphs" is not defined. (<cmd>#1) at
org.eclipse.birt.chart.factory.Generator.prepare(Generator.j ava:625) at
org.eclipse.birt.chart.reportitem.ChartReportItemGenerationI mpl.onRowSets(ChartReportItemGenerationImpl.java:136)
at
org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .generateContent(ExtendedItemExecutor.java:129)
... 33 more Caused by: org.eclipse.birt.chart.exception.ChartException:
$NO-RB$ ReferenceError: "graphs" is not defined. (<cmd>#1) at
org.eclipse.birt.chart.model.ScriptHandler.register(ScriptHa ndler.java:1184)
at
org.eclipse.birt.chart.factory.Generator.prepare(Generator.j ava:620) ...
35 more Caused by: org.mozilla.javascript.EcmaError: ReferenceError:
"graphs" is not defined. (<cmd>#1) at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3240)
at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3230)
at
org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRun time.java:3303)
at
org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRu ntime.java:1632)
at
org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java :1571) at
org.mozilla.javascript.gen.c25._c0(<cmd>:1) at
org.mozilla.javascript.gen.c25.call(<cmd>) at
org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304)
at
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769)
at
org.mozilla.javascript.gen.c25.call(<cmd>) at
org.mozilla.javascript.gen.c25.exec(<cmd>) at
org.mozilla.javascript.Context.evaluateString(Context.java:1 220) at
org.eclipse.birt.chart.model.ScriptHandler.register(ScriptHa ndler.java:1177)
... 36 more
Re: Source value can not be null [message #118822 is a reply to message #118810] Fri, 27 January 2006 09:49 Go to previous messageGo to next message
Eclipse UserFriend
It looks like it doesn't find the java class. Is "graphs" the package name?
Did you manage to run this report with the BIRT designer instead of your
program?

Thanks,

David

"Bharat Panchal" <bharat.panchal@patni.com> wrote in message
news:562269575442dcb43d5d2ab29cc59cb7$1@www.eclipse.org...
> Here is the stact trace of exception:
>
>
> org.eclipse.birt.report.engine.api.EngineException: There are problems(s)
> generating extended item Chart. at
> org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .generateContent(ExtendedItemExecutor.java:142)
> at
> org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .execute(ExtendedItemExecutor.java:90)
> at
> org.eclipse.birt.report.engine.executor.ReportExecutorVisito r.visitExtendedItem(ReportExecutorVisitor.java:81)
> at
> org.eclipse.birt.report.engine.ir.ExtendedItemDesign.accept( ExtendedItemDesign.java:30)
> at
> org.eclipse.birt.report.engine.executor.ReportExecutor.execu te(ReportExecutor.java:125)
> at
> org.eclipse.birt.report.engine.executor.ReportExecutor.execu te(ReportExecutor.java:89)
> at
> org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRenderTask.java:175)
> at
> graphs.graph.utility.GraphDesignerUtility.runReport(GraphDes ignerUtility.java:469)
> at
> graphs.graph.generator.DefaultGraphGenerator.generateDefault Graph(DefaultGraphGenerator.java:124)
> at graphs.views.GraphView.showGraph(GraphView.java:252) at
> graphs.graph.UpdateGraphAction.runWithEvent(UpdateGraphActio n.java:57) at
> org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:538)
> at
> org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:488)
> at
> org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:400)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66) at
> org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843) at
> org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3080) at
> org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2713) at
> org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1699) at
> org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663) at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:367)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:143)
> at net..ui.client.JavaClient.run(JavaClient.java:29) at
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:226)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:376)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:163)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at
> java.lang.reflect.Method.invoke(Unknown Source) at
> org.eclipse.core.launcher.Main.invokeFramework(Main.java:334 ) at
> org.eclipse.core.launcher.Main.basicRun(Main.java:278) at
> org.eclipse.core.launcher.Main.run(Main.java:973) at
> org.eclipse.core.launcher.Main.main(Main.java:948) Caused by:
> org.eclipse.birt.chart.exception.ChartException: $NO-RB$ ReferenceError:
> "graphs" is not defined. (<cmd>#1) at
> org.eclipse.birt.chart.factory.Generator.prepare(Generator.j ava:625) at
> org.eclipse.birt.chart.reportitem.ChartReportItemGenerationI mpl.onRowSets(ChartReportItemGenerationImpl.java:136)
> at
> org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .generateContent(ExtendedItemExecutor.java:129)
> ... 33 more Caused by: org.eclipse.birt.chart.exception.ChartException:
> $NO-RB$ ReferenceError: "graphs" is not defined. (<cmd>#1) at
> org.eclipse.birt.chart.model.ScriptHandler.register(ScriptHa ndler.java:1184)
> at org.eclipse.birt.chart.factory.Generator.prepare(Generator.j ava:620)
> ... 35 more Caused by: org.mozilla.javascript.EcmaError: ReferenceError:
> "graphs" is not defined. (<cmd>#1) at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3240)
> at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3230)
> at
> org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRun time.java:3303)
> at
> org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRu ntime.java:1632)
> at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java :1571) at
> org.mozilla.javascript.gen.c25._c0(<cmd>:1) at
> org.mozilla.javascript.gen.c25.call(<cmd>) at
> org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304)
> at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769)
> at org.mozilla.javascript.gen.c25.call(<cmd>) at
> org.mozilla.javascript.gen.c25.exec(<cmd>) at
> org.mozilla.javascript.Context.evaluateString(Context.java:1 220) at
> org.eclipse.birt.chart.model.ScriptHandler.register(ScriptHa ndler.java:1177)
> ... 36 more
>
>
>
>
Re: Source value can not be null [message #119495 is a reply to message #118822] Mon, 30 January 2006 00:29 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
I managed to run the chart from BIRT designer.
I implemented following method:
public void beforeDrawAxisTitle( Axis axis, Label label,
IChartScriptContext icsc )
{
label.getCaption().setValue("MY TITLE........");
}

This method gets called and works fine.

But when I integrate it with my application, I get the same exception
which I posted in previous message.

Still BIRT is not able to find the package "graphs" at runtime.
Where should I put these classes to make it run?

Thanks,
Bharat
Re: Source value can not be null [message #119516 is a reply to message #116724] Mon, 30 January 2006 01:31 Go to previous messageGo to next message
Eclipse UserFriend
Hi David,
I am planning to put following description as a bug.
Please have a look at it and confirm the same.
-------------------------------------------------------
The original chart instance in report design handle is not modified after
running the report.
In my application, I get the design time instance of chart, and then I
call method which runs the report.
I expect chart bound with data after running the report.
The same functionality was working fine (I mean: BIRT was returning chart
bound with data after running report)
till BIRT2.0M3. It's not working as expected in BIRT RC and 2.0 version.
-------------------------------------------------------

Thanks,
Bharat
Re: Source value can not be null [message #119589 is a reply to message #119495] Mon, 30 January 2006 04:40 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I got this from the script developer:
"It is supposed to go under ../webapps/birt/scriptlib if it's a jar. You can
also edit the BIRT_VIEWER_SCRIPTLIB_DIR parameter in web.xml to specify a
directory. If you don't want to use a jar, put the classes in
.../webapps/birt/WEB-INF/classes"

Let me know if you still have issues.

Thanks,

David


"Bharat Panchal" <bharat.panchal@patni.com> wrote in message
news:39772fba08c78d2c6e31a07831d6216e$1@www.eclipse.org...
> Hi, I managed to run the chart from BIRT designer.
> I implemented following method:
> public void beforeDrawAxisTitle( Axis axis, Label label,
> IChartScriptContext icsc )
> {
> label.getCaption().setValue("MY TITLE........");
> }
>
> This method gets called and works fine.
>
> But when I integrate it with my application, I get the same exception
> which I posted in previous message.
>
> Still BIRT is not able to find the package "graphs" at runtime.
> Where should I put these classes to make it run?
>
> Thanks,
> Bharat
>
Re: Source value can not be null [message #119602 is a reply to message #119516] Mon, 30 January 2006 04:41 Go to previous messageGo to next message
Eclipse UserFriend
Ok.

Thanks,

David

"Bharat Panchal" <bharat.panchal@patni.com> wrote in message
news:fa08f9bf20763b34fd5adf99a7bccb9b$1@www.eclipse.org...
> Hi David,
> I am planning to put following description as a bug.
> Please have a look at it and confirm the same.
> -------------------------------------------------------
> The original chart instance in report design handle is not modified after
> running the report.
> In my application, I get the design time instance of chart, and then I
> call method which runs the report.
> I expect chart bound with data after running the report.
> The same functionality was working fine (I mean: BIRT was returning chart
> bound with data after running report)
> till BIRT2.0M3. It's not working as expected in BIRT RC and 2.0 version.
> -------------------------------------------------------
>
> Thanks,
> Bharat
>
Re: Source value can not be null [message #119627 is a reply to message #119589] Mon, 30 January 2006 05:06 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
I couldn't find webapps directory in any of BIRT plugins.

I don't have jar files. I have the class files.
So I put these classes in
eclipse\plugins\org.eclipse.birt.report.viewer_2.0.0\birt\WE B-INF\classes
directory.
Still, its not able to find the class. I get NoClassDefFound exception.

It works fine with Report Designer.

Thanks.
Re: Source value can not be null [message #119640 is a reply to message #119602] Mon, 30 January 2006 05:08 Go to previous messageGo to next message
Eclipse UserFriend
I filed a bug. Its ID is 125678.
Re: Source value can not be null [message #119666 is a reply to message #119627] Mon, 30 January 2006 05:23 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I will double check on that. Until then I suggest you try an alternative by
putting them in a jar file.

Thanks,

David

"Bharat Panchal" <bharat.panchal@patni.com> wrote in message
news:07e4a89a95c069a62ae2f0c81bd677b7$1@www.eclipse.org...
> Hi,
> I couldn't find webapps directory in any of BIRT plugins.
>
> I don't have jar files. I have the class files.
> So I put these classes in
> eclipse\plugins\org.eclipse.birt.report.viewer_2.0.0\birt\WE B-INF\classes
> directory.
> Still, its not able to find the class. I get NoClassDefFound exception.
>
> It works fine with Report Designer.
>
> Thanks.
>
Re: Source value can not be null [message #119678 is a reply to message #119666] Mon, 30 January 2006 05:31 Go to previous messageGo to next message
Eclipse UserFriend
As you said:
"It is supposed to go under ../webapps/birt/scriptlib if it's a jar."

I can use jar file, but I don't have webapps directory in any plugin.
So where should I put the jar file?

Thanks.
Re: Source value can not be null [message #119717 is a reply to message #119666] Mon, 30 January 2006 06:22 Go to previous messageGo to next message
Eclipse UserFriend
I put the jar file in eclipse\plugins\org.eclipse.birt.core_2.0.0\lib
directory.
Now I don't get class not found exception.
But I get following exception,
-----------------------------------------
Unhandled event loop exception
Reason:
org/eclipse/birt/chart/script/ChartEventHandlerAdapter
-----------------------------------------

Thanks.
Re: Source value can not be null [message #119743 is a reply to message #119717] Mon, 30 January 2006 08:01 Go to previous messageGo to next message
Eclipse UserFriend
Can you paste the whole stack trace?

Thanks,

David

"Bharat Panchal" <bharat.panchal@patni.com> wrote in message
news:aab3f3d871298ded3bd353a46e52e0ce$1@www.eclipse.org...
>I put the jar file in eclipse\plugins\org.eclipse.birt.core_2.0.0\lib
>directory.
> Now I don't get class not found exception.
> But I get following exception,
> -----------------------------------------
> Unhandled event loop exception
> Reason:
> org/eclipse/birt/chart/script/ChartEventHandlerAdapter
> -----------------------------------------
>
> Thanks.
>
Re: Source value can not be null [message #120099 is a reply to message #119627] Mon, 30 January 2006 13:16 Go to previous messageGo to next message
Eclipse UserFriend
Did you try to put the class in the workspace?

Thanks,

David

"Bharat Panchal" <bharat.panchal@patni.com> wrote in message
news:07e4a89a95c069a62ae2f0c81bd677b7$1@www.eclipse.org...
> Hi,
> I couldn't find webapps directory in any of BIRT plugins.
>
> I don't have jar files. I have the class files.
> So I put these classes in
> eclipse\plugins\org.eclipse.birt.report.viewer_2.0.0\birt\WE B-INF\classes
> directory.
> Still, its not able to find the class. I get NoClassDefFound exception.
>
> It works fine with Report Designer.
>
> Thanks.
>
Re: Source value can not be null [message #120127 is a reply to message #119717] Mon, 30 January 2006 13:19 Go to previous messageGo to next message
Eclipse UserFriend
Please also try to put the jar under
eclipse\plugins\org.eclipse.birt.report.viewer_2.0.0\birt\WE B-INF\lib, or
eclipse\plugins\org.eclipse.birt.report.viewer_2.0.0\birt\sc riptlib

Let me know if this still doesn't work, we will look for a solution.

Thanks,

David

"Bharat Panchal" <bharat.panchal@patni.com> wrote in message
news:aab3f3d871298ded3bd353a46e52e0ce$1@www.eclipse.org...
>I put the jar file in eclipse\plugins\org.eclipse.birt.core_2.0.0\lib
>directory.
> Now I don't get class not found exception.
> But I get following exception,
> -----------------------------------------
> Unhandled event loop exception
> Reason:
> org/eclipse/birt/chart/script/ChartEventHandlerAdapter
> -----------------------------------------
>
> Thanks.
>
Re: Source value can not be null [message #120619 is a reply to message #120099] Mon, 30 January 2006 23:37 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
So far this is what I have done.

Created separate plugin which holds follwing two classes.

**********************************************************
1. Graph event handler class
**********************************************************
package myGraphs;
public class GraphEventHandler extends ChartEventHandlerAdapter{
public void afterDataSetFilled( Series series, DataSet dataSet,
IChartScriptContext icsc ){
System.out.println("IN GraphEventHandler");
GraphObject graphObject = GraphObject.getInstance();
Chart chart = (Chart) icsc;
graphObject.setChart(chart);
}
}

**********************************************************
2. Singleton class, which has chart as memeber variable.
**********************************************************

package myGraphs;
import org.eclipse.birt.chart.model.Chart;

public class GraphObject {

private static GraphObject graphObject = null;
private Chart chart;

private GraphObject(){
}

public static GraphObject getInstance(){
if(graphObject==null){
graphObject = new GraphObject();
}
return graphObject;
}

public void setChart(Chart chart){
this.chart = chart;
}

public Chart getChart(){
return chart;
}
}

**********************************************************

In graph plugin,
After running the report, I call GraphObject.getInstance() method then I
call getChart() method,
Which should return me chart bound with dataset.

I have created myGraphs.jar and put it in
eclipse\plugins\org.eclipse.birt.report.viewer_2.0.0\birt\WE B-INF\lib. But
got the exception.

I have also tried to put it in
eclipse\plugins\org.eclipse.birt.report.viewer_2.0.0\birt\sc riptlib. Still
it didn't work.
(There was no scriptlib directory in my
eclipse\plugins\org.eclipse.birt.report.viewer_2.0.0\birt
folder. So I created one.)

I have also tried to put in workspace and got exception.

In above cases I got following exception,
---------------------------------

org.eclipse.birt.report.engine.api.EngineException:
There are problems(s) generating extended item Chart. at
org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .generateContent(ExtendedItemExecutor.java:142)
at
org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .execute(ExtendedItemExecutor.java:90)
at
org.eclipse.birt.report.engine.executor.ReportExecutorVisito r.visitExtendedItem(ReportExecutorVisitor.java:81)
at
org.eclipse.birt.report.engine.ir.ExtendedItemDesign.accept( ExtendedItemDesign.java:30)
at
org.eclipse.birt.report.engine.executor.ReportExecutor.execu te(ReportExecutor.java:125)
at
org.eclipse.birt.report.engine.executor.ReportExecutor.execu te(ReportExecutor.java:89)
at
org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRenderTask.java:175)
at
graphs.graph.utility.GraphDesignerUtility.runReport(GraphDes ignerUtility.java:472)
at
graphs.graph.generator.DefaultGraphGenerator.generateDefault Graph(DefaultGraphGenerator.java:124)
at
graphs.views.GraphView.showGraph(GraphView.java:252) at
graphs.graph.UpdateGraphAction.runWithEvent(UpdateGraphActio n.java:57) at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:538)
at
org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:488)
at
org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:400)
at
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66) at
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843) at
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3080) at
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2713) at
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1699) at
org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663) at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:367)
at
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:143) at
net.mycom.ui.client.JavaClient.run(JavaClient.java:29) at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:226)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:376)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:163)
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at
java.lang.reflect.Method.invoke(Unknown Source) at
org.eclipse.core.launcher.Main.invokeFramework(Main.java:334 ) at
org.eclipse.core.launcher.Main.basicRun(Main.java:278) at
org.eclipse.core.launcher.Main.run(Main.java:973) at
org.eclipse.core.launcher.Main.main(Main.java:948)

Caused by:
org.eclipse.birt.chart.exception.ChartException: $NO-RB$ ReferenceError:
"myGraphs" is not defined. (<cmd>#1) at
org.eclipse.birt.chart.factory.Generator.prepare(Generator.j ava:625) at
org.eclipse.birt.chart.reportitem.ChartReportItemGenerationI mpl.onRowSets(ChartReportItemGenerationImpl.java:136)
at
org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .generateContent(ExtendedItemExecutor.java:129)

... 33 more

Caused by: org.eclipse.birt.chart.exception.ChartException: $NO-RB$
ReferenceError: "myGraphs" is not defined. (<cmd>#1) at
org.eclipse.birt.chart.model.ScriptHandler.register(ScriptHa ndler.java:1184)
at
org.eclipse.birt.chart.factory.Generator.prepare(Generator.j ava:620) ...
35 more

Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "myGraphs" is
not defined. (<cmd>#1) at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3240)
at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3230)
at
org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRun time.java:3303)
at
org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRu ntime.java:1632)
at
org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java :1571) at
org.mozilla.javascript.gen.c13._c0(<cmd>:1) at
org.mozilla.javascript.gen.c13.call(<cmd>) at
org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304)
at
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769)
at
org.mozilla.javascript.gen.c13.call(<cmd>) at
org.mozilla.javascript.gen.c13.exec(<cmd>) at
org.mozilla.javascript.Context.evaluateString(Context.java:1 220) at
org.eclipse.birt.chart.model.ScriptHandler.register(ScriptHa ndler.java:1177)
... 36 more

---------------------------------

Thanks.
Re: Source value can not be null [message #121561 is a reply to message #120619] Tue, 31 January 2006 06:36 Go to previous messageGo to next message
Eclipse UserFriend
Is it possible that you send me your plugin with its dependencies in a zip
so that I can debug it and see how to fix it. I could make a few more
guesses, but it's likely to take time to resolve this. If I could debug,
that would really speed up the resolution.

Thanks,

David

"Bharat Panchal" <bharat.panchal@patni.com> wrote in message
news:a7bad9d57960587ef904b40e8e48f1a3$1@www.eclipse.org...
> Hi,
> So far this is what I have done.
>
> Created separate plugin which holds follwing two classes.
>
> **********************************************************
> 1. Graph event handler class
> **********************************************************
> package myGraphs;
> public class GraphEventHandler extends ChartEventHandlerAdapter{
> public void afterDataSetFilled( Series series, DataSet dataSet,
> IChartScriptContext icsc ){
> System.out.println("IN GraphEventHandler");
> GraphObject graphObject = GraphObject.getInstance();
> Chart chart = (Chart) icsc;
> graphObject.setChart(chart);
> }
> }
>
> **********************************************************
> 2. Singleton class, which has chart as memeber variable.
> **********************************************************
>
> package myGraphs;
> import org.eclipse.birt.chart.model.Chart;
>
> public class GraphObject {
>
> private static GraphObject graphObject = null;
> private Chart chart;
>
> private GraphObject(){
> }
>
> public static GraphObject getInstance(){
> if(graphObject==null){
> graphObject = new GraphObject();
> }
> return graphObject;
> }
>
> public void setChart(Chart chart){
> this.chart = chart;
> }
>
> public Chart getChart(){
> return chart;
> }
> }
>
> **********************************************************
>
> In graph plugin, After running the report, I call
> GraphObject.getInstance() method then I call getChart() method,
> Which should return me chart bound with dataset.
>
> I have created myGraphs.jar and put it in
> eclipse\plugins\org.eclipse.birt.report.viewer_2.0.0\birt\WE B-INF\lib. But
> got the exception.
>
> I have also tried to put it in
> eclipse\plugins\org.eclipse.birt.report.viewer_2.0.0\birt\sc riptlib. Still
> it didn't work.
> (There was no scriptlib directory in my
> eclipse\plugins\org.eclipse.birt.report.viewer_2.0.0\birt
> folder. So I created one.)
>
> I have also tried to put in workspace and got exception.
>
> In above cases I got following exception,
> ---------------------------------
>
> org.eclipse.birt.report.engine.api.EngineException: There are problems(s)
> generating extended item Chart. at
> org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .generateContent(ExtendedItemExecutor.java:142)
> at
> org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .execute(ExtendedItemExecutor.java:90)
> at
> org.eclipse.birt.report.engine.executor.ReportExecutorVisito r.visitExtendedItem(ReportExecutorVisitor.java:81)
> at
> org.eclipse.birt.report.engine.ir.ExtendedItemDesign.accept( ExtendedItemDesign.java:30)
> at
> org.eclipse.birt.report.engine.executor.ReportExecutor.execu te(ReportExecutor.java:125)
> at
> org.eclipse.birt.report.engine.executor.ReportExecutor.execu te(ReportExecutor.java:89)
> at
> org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRenderTask.java:175)
> at
> graphs.graph.utility.GraphDesignerUtility.runReport(GraphDes ignerUtility.java:472)
> at
> graphs.graph.generator.DefaultGraphGenerator.generateDefault Graph(DefaultGraphGenerator.java:124)
> at graphs.views.GraphView.showGraph(GraphView.java:252) at
> graphs.graph.UpdateGraphAction.runWithEvent(UpdateGraphActio n.java:57) at
> org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:538)
> at
> org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:488)
> at
> org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:400)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66) at
> org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843) at
> org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3080) at
> org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2713) at
> org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1699) at
> org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663) at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:367)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:143)
> at net.mycom.ui.client.JavaClient.run(JavaClient.java:29) at
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:226)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:376)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:163)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at
> java.lang.reflect.Method.invoke(Unknown Source) at
> org.eclipse.core.launcher.Main.invokeFramework(Main.java:334 ) at
> org.eclipse.core.launcher.Main.basicRun(Main.java:278) at
> org.eclipse.core.launcher.Main.run(Main.java:973) at
> org.eclipse.core.launcher.Main.main(Main.java:948)
> Caused by: org.eclipse.birt.chart.exception.ChartException: $NO-RB$
> ReferenceError: "myGraphs" is not defined. (<cmd>#1) at
> org.eclipse.birt.chart.factory.Generator.prepare(Generator.j ava:625) at
> org.eclipse.birt.chart.reportitem.ChartReportItemGenerationI mpl.onRowSets(ChartReportItemGenerationImpl.java:136)
> at
> org.eclipse.birt.report.engine.executor.ExtendedItemExecutor .generateContent(ExtendedItemExecutor.java:129)
> .. 33 more
> Caused by: org.eclipse.birt.chart.exception.ChartException: $NO-RB$
> ReferenceError: "myGraphs" is not defined. (<cmd>#1) at
> org.eclipse.birt.chart.model.ScriptHandler.register(ScriptHa ndler.java:1184)
> at org.eclipse.birt.chart.factory.Generator.prepare(Generator.j ava:620)
> ... 35 more
> Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "myGraphs" is
> not defined. (<cmd>#1) at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3240)
> at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRu ntime.java:3230)
> at
> org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRun time.java:3303)
> at
> org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRu ntime.java:1632)
> at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java :1571) at
> org.mozilla.javascript.gen.c13._c0(<cmd>:1) at
> org.mozilla.javascript.gen.c13.call(<cmd>) at
> org.mozilla.javascript.ContextFactory.doTopCall(ContextFacto ry.java:304)
> at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime .java:2769)
> at org.mozilla.javascript.gen.c13.call(<cmd>) at
> org.mozilla.javascript.gen.c13.exec(<cmd>) at
> org.mozilla.javascript.Context.evaluateString(Context.java:1 220) at
> org.eclipse.birt.chart.model.ScriptHandler.register(ScriptHa ndler.java:1177)
> ... 36 more
>
> ---------------------------------
>
> Thanks.
>
Re: Source value can not be null [message #122422 is a reply to message #121561] Wed, 01 February 2006 01:28 Go to previous messageGo to next message
Eclipse UserFriend
My application is integrated with other application.
So it won't be feasible to send the code.

Thanks.
Re: Source value can not be null [message #122501 is a reply to message #122422] Wed, 01 February 2006 03:33 Go to previous messageGo to next message
Eclipse UserFriend
Ok, I think the best option now is to file a bug for this issue, I will
spend some time to reproduce this problem. One thing you could try is set
the classpath to your script through one of those system variables:
public static final String WEBAPP_CLASSPATH_KEY =
"webapplication.projectclasspath"; //$NON-NLS-1$

public static final String WORKSPACE_CLASSPATH_KEY =
"workspace.projectclasspath"; //$NON-NLS-1$

public static final String PROJECT_CLASSPATH_KEY = "user.projectclasspath";
//$NON-NLS-1$

I'm not sure it will work as they might be overriden at some point, but that
is where the script classloader is currently looking at.

Alternatively you can try to use the Chart API to execute the chart directly
rather than going through the report generation. This requires some work,
but it will also let you plug your own class loader through
IScriptClassLoader. It should also be somewhat faster to simply run the
chart, than the full report. I don't know how your data is available to you,
but you can feed it to the chart through a sql.ResultSet for instance. You
can create the chart using the chart model api, or extract the xml from the
report design, save it in a file and load it directly with the Chart API.

Thanks,

David

"Bharat Panchal" <bharat.panchal@patni.com> wrote in message
news:a32083dd6af09249d94324bf67035766$1@www.eclipse.org...
> My application is integrated with other application.
> So it won't be feasible to send the code.
>
> Thanks.
>
>
Re: Source value can not be null [message #123530 is a reply to message #116724] Fri, 03 February 2006 01:11 Go to previous message
Eclipse UserFriend
Hi,
I set the webapplication.projectclasspath to my project class path.
Now My GraphEventHandler class is coming in picture.

But the method afterDataSetFilled is not being called by BIRT.

I have implemented following two method and those are being called.

public void beforeRendering( GeneratedChartState gcs,
IChartScriptContext icsc )
{
System.out.println("IN GraphEventHandler beforeRendering");
}

public void afterRendering( GeneratedChartState gcs,
IChartScriptContext icsc )
{
System.out.println("IN GraphEventHandler afterRendering");
Chart chart = icsc.getChartInstance();
GraphDesignerUtility.chart1 = chart;
System.out.println(" after IN GraphEventHandler afterRendering");

}

It displays println statements at console.

I tried to assign the chart instance to one memeber variable of my class
in afterRendering() method.
But the member variable doesn't get initialized.
Control goes in wait mode.
Event it doesn't execute the next statement(System.out.println(" after IN
GraphEventHandler afterRendering");).

Kindly inform me what I'm doing wrong here.

Thanks.
Previous Topic:Engine API Example
Next Topic:Install instructions for iText
Goto Forum:
  


Current Time: Fri Jul 18 15:38:03 EDT 2025

Powered by FUDForum. Page generated in 0.19455 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top