隨筆-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  回復  更多評論
            

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


          網站導航:
           
          主站蜘蛛池模板: 蓬安县| 博野县| 古交市| 铁岭市| 普宁市| 塔城市| 调兵山市| 双牌县| 柳州市| 景谷| 易门县| 宁国市| 沾益县| 五莲县| 福建省| 集贤县| 隆德县| 肥城市| 山东| 定南县| 太保市| 龙口市| 会宁县| 龙江县| 沈丘县| 秦安县| 湟中县| 容城县| 乌拉特中旗| 岚皋县| 碌曲县| 合水县| 青川县| 万山特区| 会宁县| 昌都县| 富宁县| 鄄城县| 沧州市| 株洲县| 河曲县|