KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > birt > chart > examples > api > script > java > BlockScript


1 /*******************************************************************************
2  * Copyright (c) 2004 Actuate Corporation.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * Actuate Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.birt.chart.examples.api.script.java;
13
14 import org.eclipse.birt.chart.model.layout.Block;
15 import org.eclipse.birt.chart.model.attribute.impl.ColorDefinitionImpl;
16 import org.eclipse.birt.chart.script.ChartEventHandlerAdapter;
17 import org.eclipse.birt.chart.script.IChartScriptContext;
18
19 public class BlockScript extends ChartEventHandlerAdapter
20 {
21
22     /*
23      * (non-Javadoc)
24      *
25      * @see org.eclipse.birt.chart.script.IChartItemScriptHandler#beforeDrawBlock(org.eclipse.birt.chart.model.layout.Block,
26      * org.eclipse.birt.chart.script.IChartScriptContext)
27      */

28     public void beforeDrawBlock( Block block, IChartScriptContext icsc )
29     {
30         if ( block.isLegend( ) )
31         {
32             block.getOutline( ).setVisible( true );
33             block.getOutline( ).getColor( ).set( 21, 244, 231 );
34         }
35         else if ( block.isPlot( ) )
36         {
37             block.getOutline( ).setVisible( true );
38             block.getOutline( ).getColor( ).set( 244, 21, 231 );
39         }
40         else if ( block.isTitle( ) )
41         {
42             block.getOutline( ).setVisible( true );
43             block.setBackground( ColorDefinitionImpl.CREAM( ) );
44             block.getOutline( ).getColor( ).set( 0, 0, 0 );
45         }
46     }
47
48 }
49
Popular Tags