隨筆-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 閱讀(477) 評論(1)  編輯  收藏

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

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


          網站導航:
           
          主站蜘蛛池模板: 八宿县| 石河子市| 新宾| 莆田市| 尤溪县| 随州市| 宽城| 和龙市| 宜君县| 石楼县| 开鲁县| 上高县| 修武县| 新兴县| 南木林县| 乐山市| 宁远县| 绥滨县| 万载县| 庆安县| 固安县| 文昌市| 梅州市| 亳州市| 湾仔区| 沂南县| 沂源县| 巴楚县| 即墨市| 开远市| 庆云县| 清涧县| 六安市| 紫金县| 呼图壁县| 徐州市| 辉县市| 通城县| 丹巴县| 定边县| 聊城市|