KickJava   Java API By Example, From Geeks To Geeks.

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


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.attribute.AxisType;
15 import org.eclipse.birt.chart.model.component.Axis;
16 import org.eclipse.birt.chart.model.component.Label;
17 import org.eclipse.birt.chart.script.ChartEventHandlerAdapter;
18 import org.eclipse.birt.chart.script.IChartScriptContext;
19
20 /**
21  *
22  */

23
24 public class AxisScript extends ChartEventHandlerAdapter
25 {
26     /*
27      * (non-Javadoc)
28      *
29      * @see org.eclipse.birt.chart.script.IChartItemScriptHandler#beforeDrawAxisLabel(org.eclipse.birt.chart.model.component.Axis,
30      * org.eclipse.birt.chart.model.component.Label,
31      * org.eclipse.birt.chart.script.IChartScriptContext)
32      */

33     public void beforeDrawAxisLabel( Axis axis, Label label,
34             IChartScriptContext icsc )
35     {
36         if (axis.getType() == AxisType.TEXT_LITERAL)
37         {
38             label.getCaption( ).getColor( ).set( 140, 198, 62 );
39         }else
40         {
41             label.getCaption().getColor( ).set( 208, 32, 0);
42         }
43     }
44
45     /*
46      * (non-Javadoc)
47      *
48      * @see org.eclipse.birt.chart.script.IChartItemScriptHandler#beforeDrawAxisTitle(org.eclipse.birt.chart.model.component.Axis,
49      * org.eclipse.birt.chart.model.component.Label,
50      * org.eclipse.birt.chart.script.IChartScriptContext)
51      */

52     public void beforeDrawAxisTitle( Axis axis, Label label,
53             IChartScriptContext icsc )
54     {
55         if (axis.getType() == AxisType.TEXT_LITERAL)
56         {
57             label.getCaption( ).getColor( ).set( 140, 198, 62 );
58         }else
59         {
60             label.getCaption().getColor( ).set( 208, 32, 0);
61         }
62     }
63 }
64
Popular Tags