隨筆-112  評論-73  文章-0  trackbacks-0

          有轉載有原創,就算做個整理吧.

          1、row 的背景顏色交替變換

          選中table ->details 然后在

          onPrepare方法中加入下面代碼

          var count=1;

          在onCreate方法中加入下面代碼

          count++;
          this.getStyle().backgroundColor=(count%2==0?"red":"blue");

          這樣表格就可以是紅藍交替顯示了。

          2、按一定的條件顯示特定行,比如以紅色顯示數量小于0的行

          if( row["inQ"]<0)
          this.getStyle().backgroundColor="red";

          其中之一"inQ"是表中的列名,不一定是數據集成的列名,一開始以為是數據集成的列名,搞了好長時間。如果列名與數據集中的列名一樣就沒有問題了。

          3、參數類型

          birt 報表中的日期(date)型參數是java.sql.Date而不是java.util.Date

          是看birt 源碼才知道,下面是檢查參數類型的方法的代碼

          private boolean validateParameterValueType(String paramName, Object paramValue, String type, ScalarParameterHandle paramHandle)
          throws ParameterValidationException
          {
          if("decimal".equals(type) || "float".equals(type))
          if(paramValue instanceof Number)
          return true;
          else
          throw new ParameterValidationException("Error.InvalidParameterType", new String[] {
          paramName, type, paramValue.getClass().getName()
          });
          if("dateTime".equals(type))
          if(paramValue instanceof Date)
          return true;
          else
          throw new ParameterValidationException("Error.InvalidParameterType", new String[] {
          paramName, type, paramValue.getClass().getName()
          });
          if("date".equals(type))
          if(paramValue instanceof java.sql.Date)
          return true;
          else
          throw new ParameterValidationException("Error.InvalidParameterType", new String[] {
          paramName, type, paramValue.getClass().getName()
          });
          if("time".equals(type))
          if(paramValue instanceof Time)
          return true;
          else
          throw new ParameterValidationException("Error.InvalidParameterType", new String[] {
          paramName, type, paramValue.getClass().getName()
          });
          if("string".equals(type))
          {
          if(paramHandle.isRequired())
          {
          String value = paramValue.toString().trim();
          if(value.length() == 0)
          throw new ParameterValidationException("Error.ParameterValueBlank", new String[] {
          paramName
          });
          }
          return true;
          }
          if("boolean".equals(type))
          {
          if(paramValue instanceof Boolean)
          return true;
          else
          throw new ParameterValidationException("Error.InvalidParameterType", new String[] {
          paramName, type, paramValue.getClass().getName()
          });
          } else
          {
          return true;
          }
          }


          Technorati :

          posted on 2008-05-16 16:14 Libo 閱讀(475) 評論(1)  編輯  收藏

          評論:
          # re: birt應用 2008-06-25 11:45 | RogerTu
          不錯,推薦BIRT官方中文論壇 http://www.actuatechina.com/index.php  回復  更多評論
            

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 基隆市| 平武县| 万载县| 寿宁县| 乌兰县| 高雄市| 平泉县| 定兴县| 安泽县| 育儿| 铜川市| 南部县| 浦江县| 南宫市| 名山县| 阿巴嘎旗| 金阳县| 蒙阴县| 西安市| 东台市| 盐边县| 霍州市| 大悟县| 保亭| 新乡县| 赤水市| 定结县| 昌图县| 泗水县| 汉寿县| 泸水县| 梁河县| 墨竹工卡县| 黑河市| 铜山县| 浙江省| 肇源县| 麟游县| 霍邱县| 集安市| 夹江县|