ÔÚEclipseÖÐÓÃJavaʵÏÖ°ÙÁ鱨±í(BIRT)µÄʼþ´¦Àí
8. µ±ÏµÍ³´¦ÀíÍê³Éºó£¬±¨±í±»ÏÔʾ³öÀ´¡£ÕâÊÇÒ»·ÝÉÌÆ·ÏúÊÛ±¨¸æ£¬ÏÔʾµÄÊÇÿÀàÉÌÆ·µÄ¼¾¶ÈÏúÊÛ¶îÒÔ¼°ÀÛ¼ÆÇé¿ö¡£½ÓÏÂÀ´£¬ÎÒÃdz¢ÊÔÓà Java
´´½¨Ò»¸öʼþÏìÓ¦´¦ÀíÀ࣬°Ñÿ¼¾¶ÈÏúÊÛ¶îÔÚ10ÍòÃÀÔªÒÔÉϵÄÊý¾ÝÓúìÉ«±êʾ³öÀ´¡£
´´½¨ Java Àà
°´ÕÕÈçϲ½Ö裬Óà Java ´´½¨°ÙÁ鱨±í£¨BIRT£©µÄʼþÏìÓ¦´¦Àí³ÌÐò¡£
ͼ 16. ´´½¨ Java Àà
1. ÔÚÖ÷²Ëµ¥ÖÐÑ¡Ôñ File -> New -> Class ²Ëµ¥Ï´ò¿ª New Java Class
¶Ô»°¿ò¡£
ͼ 17. New Java Class ¶Ô»°¿ò
2. ÔÚ New Java Class ¶Ô»°¿òµÄ Name ´¦ÊäÈë DataItemEventHandler
£¬×÷Ϊ¸ÃʼþÏìÓ¦´¦ÀíÀàµÄÃû×Ö¡£µ¥»÷ Browse…… °´Å¥£¬´ò¿ª Superclass Selection ¶Ô»°¿ò¡£Ñ¡Ôñ»òÖ±½ÓÊäÈë
"org.eclipse.birt.report.engine.api.script.eventadapter.DataItemEventAdapter"
×÷Ϊ¸¸Àà¡£
3. µ¥»÷ Finish °´Å¥£¬Ò»¸öÃû³ÆΪ DataItemEventHandler.java
µÄÎļþ±»´´½¨³öÀ´£¬ÔÚÕâ¸öÎļþÀïÊäÈëÈçÏ´úÂ룺
Çåµ¥ 1. ±¨±íʼþÏìÓ¦´¦ÀíÀà
import
org.eclipse.birt.report.engine.api.script.IReportContext;
import
org.eclipse.birt.report.engine.api.script.eventadapter.DataItemEventAdapter;
import
org.eclipse.birt.report.engine.api.script.instance.IDataItemInstance;
public
class DataItemEventHandler extends DataItemEventAdapter {
public void
onRender(IDataItemInstance data, IReportContext reportContext)
{
super.onRender(data, reportContext);
if (((Double)
data.getValue()).doubleValue() > 100000)
{
data.getStyle().setColor("red");
}
}
}
ÔÚÉÏÃæÕâ¶Î´úÂëÖУ¬ÎÒÃÇÖØдÁË DataItemEventHandler ÀàµÄ onRender ·½·¨¡£¸Ã·½·¨´øÓÐÁ½¸ö²ÎÊý£¬ÆäÖÐ data
¾ÍÊǵ±Ç°ÎÒÃÇÒª²Ù×÷µÄÊý¾ÝʵÀý£¬ÔÚÕâÀïÎÒÃÇͨ¹ýÌõ¼þÅжÏÀ´°Ñ´óÓÚ10ÍòÃÀÔªµÄÊý¾ÝÉèÖÃΪºìÉ«¡£ÁíÍâÒ»¸ö²ÎÊý reportContext
ÔòÊÇÒ»¸öÈ«¾ÖµÄÉÏÏÂÎĶÔÏó£¬ÀûÓÃÕâ¸öÉÏÏÂÎĶÔÏ󣬿ÉÒÔÔÚ²»Í¬µÄʼþÏìÓ¦´¦ÀíÀàÖд«µÝÐÅÏ¢¡£
4. È·ÈÏÎÞÎóºó´æÅÌ£¬±¨±íʼþÏìÓ¦´¦ÀíÀà´´½¨Íê³É¡£
Java ÀàÓ뱨±í¹ØÁª
°´ÕÕÈçϲ½Ö裬½«´´½¨ºÃµÄ Java ʼþÏìÓ¦´¦ÀíÀàºÍÑùÀý±¨±í¹ØÁªÆðÀ´¡£
Ïà¹ØÎĵµ£º
¹ØÓÚJavaÖи÷ÖÖÐÞÊηûÓë·ÃÎÊÐÞÊηûµÄ˵Ã÷
Àࣺ
·ÃÎÊÐÞÊηû ÐÞÊηû class ÀàÃû³Æ extends ¸¸ÀàÃû³Æ implement ½Ó¿ÚÃû³Æ
£¨·ÃÎÊÐÞÊηûÓëÐÞÊηûµÄλÖÿÉÒÔ»¥»»£©
·ÃÎÊÐÞÊηû
Ãû³Æ
˵Ã÷
±¸×¢
public
¿ÉÒÔ±»ËùÓÐÀà·ÃÎÊ£¨Ê¹Óã©
publicÀà±ØÐ붨ÒåÔÚºÍÀàÃûÏàͬµÄͬÃûÎļþÖÐ
package
¿ÉÒÔ±»Í¬Ò»¸ö°üÖеÄÀà·ÃÎ ......
±¸×¢£º
±¾ÎÄÑ¡×ÔChinaITLabÍøУ¿Î³Ì¡¶ÁõÏþÌÎJava¾Íҵֱͨ°àV2.0¡·Ö®Ô¤±¸ÖªÊ¶£¬µã»÷ÕâÀïÁ˽â¸ü¶à£¡
JAVAѧϰ֮·---ѧϰ·Ïß¼°Òªµã
2£®Èí¼þ¿ª·¢Ñ§Ï°Â·Ïß
Á½Ç§¶àÄêµÄÈå¼Ò˼Ïë¿×ÃÏÖ®µÀ£¬ÖÐÓ¹µÄ˼Ïë͸Èë¹ÇË裬¼È²»Ã°½øÒ²²»±£Êز¢·ÇÖÐÓ¹Ö®µÀ£¬¶øÊÇÕÒѰѧϰÈí¼þ¿ª·¢µÄÕýȷ·ÏßÓë¹æÂÉ¡£
´ÓÈí¼þ¿ª·¢ÈËÔ±µÄÉúÑĹ滮À´½²£¬ÎÒÃÇ¿É ......
ÔÌùµØÖ·¸½ÓÚ´Ë£º Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=602711 È«ÎÄÈçÏ£º
javaѧϰ֮µÀ
1.µ½ÍøÉÏ¿´¿´¸ßÊÖ¶ÔJAVAµÄһЩ¿´·¨£¬ÒÔ¼°JavaµÄÇ°¾°¡£
2.дһ¸ö¼òµ¥µÄÈëÃÅÀý×Ó£¬±ÈÈçHelloWorld£¬¿ÉÒÔʹÓÃUltraEditÀ´Ð´£¬ÈÃÄã¶ÔJAVAµÄ±àÒëÔËÐÐÓÐÒ»¸ö¸ÐÐÔµÄÈÏʶ¡£
3.ϵͳµØ·ôdzµØÁ˽âJavaµÄ¸÷¸ö²¿·Ö£¬° ......