Example #1
0
 protected void createStateImpl(
     RuntimeManager rtm, HttpServletRequest request, JspComponentState state) {
   DataPointRT dataPointRT = rtm.getDataPoint(this.dataPointVO.getId());
   String value;
   if (dataPointRT == null) {
     value = this.disabledValue;
   } else {
     PointValueTime pvt = dataPointRT.getPointValue();
     if ((pvt != null) && ((pvt.getValue() instanceof ImageValue))) {
       Map model = new HashMap();
       model.put("point", this.dataPointVO);
       model.put("pointValue", pvt);
       value = BaseDwr.generateContent(request, "imageValueThumbnail.jsp", model);
     } else {
       int hint = this.raw ? 1 : 2;
       value = this.dataPointVO.getTextRenderer().getText(pvt, hint);
       if ((pvt != null) && (this.time)) state.setTime(Long.valueOf(pvt.getTime()));
     }
   }
   state.setValue(value);
 }
  @Override
  protected void createStateImpl(
      RuntimeManager rtm, HttpServletRequest request, JspComponentState state) {
    String value;
    DataPointRT dataPointRT = rtm.getDataPoint(dataPointVO.getId());
    if (dataPointRT == null) value = disabledValue;
    else {
      PointValueTime pvt = dataPointRT.getPointValue();

      if (pvt != null && pvt.getValue() instanceof ImageValue) {
        // Text renderers don't help here. Create a thumbnail.
        Map<String, Object> model = new HashMap<String, Object>();
        model.put("point", dataPointVO);
        model.put("pointValue", pvt);
        value = BaseDwr.generateContent(request, "imageValueThumbnail.jsp", model);
      } else {
        int hint = raw ? TextRenderer.HINT_RAW : TextRenderer.HINT_FULL;
        value = dataPointVO.getTextRenderer().getText(pvt, hint);
        if (pvt != null && time) state.setTime(pvt.getTime());
      }
    }
    state.setValue(value);
  }