Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » How to get a Chart from a ReportDesignHandle?
How to get a Chart from a ReportDesignHandle? [message #757002] Tue, 15 November 2011 22:37 Go to next message
js Missing name is currently offline js Missing name
Messages: 73
Registered: July 2009
Member
I have read a .rptdesign file containing a Line Chart into a ReportDesignHandle. Now I would like to find this chart through the ReportDesignHandle:

  public static Chart findChart(ReportDesignHandle design) {
    SlotHandle sh = design.getBody();
    Iterator<?> it = sh.iterator();
    while (it.hasNext()) {
      DesignElementHandle de = (DesignElementHandle) it.next();
      DesignElement element = de.getElement();
      if (element instanceof ExtendedItem) {
        ExtendedItem ext = (ExtendedItem) element;
        // How do see that this is a chart?
      }
    }
    return null;
  }


It seems that the chart is an extended item, but how do I read it from this item?

Or is there a better way to read a Chart from a ReportDesignHandle?
Re: How to get a Chart from a ReportDesignHandle? [message #757046 is a reply to message #757002] Wed, 16 November 2011 08:52 Go to previous messageGo to next message
js Missing name is currently offline js Missing name
Messages: 73
Registered: July 2009
Member
Just found that pp 325 in Integrating and Extending BIRT:

http://www.amazon.com/Integrating-Extending-BIRT-Jason-Weathersby/dp/0321580303

has some examples on this.
Re: How to get a Chart from a ReportDesignHandle? [message #757818 is a reply to message #757002] Wed, 16 November 2011 15:50 Go to previous message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Once you have the extended item handle check the extension name for
Chart then to get the chart model get the property chart.instance.


ExtendedItemHandle eih = (ExtendedItemHandle) designHandle.getBody( )
.getContents( ).get( 0 );

String name = eih.getExtensionName();
if( name.equalsIgnoreCase("Chart")){
Chart cm = null;
try
{
cm = (Chart) eih.getReportItem( ).getProperty( "chart.instance"); }
catch ( ExtendedElementException e )
{
// TODO Auto-generated catch block
e.printStackTrace( );
}

Jason


On 11/15/2011 5:37 PM, js wrote:
> I have read a .rptdesign file containing a Line Chart into a
> ReportDesignHandle. Now I would like to find this chart through the
> ReportDesignHandle:
>
>
> public static Chart findChart(ReportDesignHandle design) {
> SlotHandle sh = design.getBody();
> Iterator<?> it = sh.iterator();
> while (it.hasNext()) {
> DesignElementHandle de = (DesignElementHandle) it.next();
> DesignElement element = de.getElement();
> if (element instanceof ExtendedItem) {
> ExtendedItem ext = (ExtendedItem) element;
> // How do see that this is a chart?
> }
> }
> return null;
> }
>
>
> It seems that the chart is an extended item, but how do I read it from
> this item?
>
> Or is there a better way to read a Chart from a ReportDesignHandle?
Previous Topic:Dates not showing on report
Next Topic:Error with dataset reading from a BIT DATA column
Goto Forum:
  


Current Time: Thu Oct 23 18:36:39 GMT 2014

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

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