Exemplo n.º 1
0
  //
  //
  // Data points
  //
  public void saveDataPoint(DataPointVO point) {
    stopDataPoint(point.getId());

    // Since the point's data type may have changed, we must ensure that the other attrtibutes are
    // still ok with
    // it.
    int dataType = point.getPointLocator().getDataTypeId();

    // Chart renderer
    if (point.getChartRenderer() != null && !point.getChartRenderer().getDef().supports(dataType))
      // Return to a default renderer
      point.setChartRenderer(null);

    // Text renderer
    if (point.getTextRenderer() != null && !point.getTextRenderer().getDef().supports(dataType))
      // Return to a default renderer
      point.defaultTextRenderer();

    // Event detectors
    Iterator<PointEventDetectorVO> peds = point.getEventDetectors().iterator();
    while (peds.hasNext()) {
      PointEventDetectorVO ped = peds.next();
      if (!ped.getDef().supports(dataType))
        // Remove the detector.
        peds.remove();
    }

    new DataPointDao().saveDataPoint(point);

    if (point.isEnabled()) startDataPoint(point);
  }