Example #1
0
  /**
   * @param widget ADLWidget that describe the StripChart.
   * @param storedDynamicAttribute
   * @param storedBasicAttribute
   * @throws WrongADLFormatException
   */
  public StripChart(
      final ADLWidget widget, ADLWidget storedBasicAttribute, ADLWidget storedDynamicAttribute)
      throws WrongADLFormatException {
    super(widget, storedBasicAttribute, storedDynamicAttribute);

    _widget.setPropertyValue(AbstractChartModel.PROP_SHOW_AXES, 3);
    _widget.setPropertyValue(
        AbstractWidgetModel.PROP_BORDER_STYLE, BorderStyleEnum.RAISED.getIndex());
    _widget.setPropertyValue(AbstractChartModel.PROP_AUTOSCALE, true);

    for (ADLWidget srtipChartPart : widget.getObjects()) {
      if (srtipChartPart.getType().equalsIgnoreCase("plotcom")) {
        plotcom(srtipChartPart);
      } else if (srtipChartPart.getType().startsWith("pen")) {
        pen(srtipChartPart);
      }
    }
    for (FileLine fileLine : widget.getBody()) {
      String ctripChart = fileLine.getLine();
      String[] row = ctripChart.trim().split("="); // $NON-NLS-1$
      if (row.length != 2) {
        throw new WrongADLFormatException(Messages.Bargraph_1);
      }
      if (row[0].equals("period")) { // $NON-NLS-1$
        double period = Double.parseDouble(row[1]) / 1000;
        //                _widget.setPropertyValue(StripChartModel.PROP_X_AXIS_TIMESPAN, period);
        _widget.setPropertyValue(StripChartModel.PROP_UPDATE_INTERVAL, period);
      } else if (row[0].equals("units")) { // $NON-NLS-1$
        _widget.setPropertyValue(AbstractChartModel.PROP_X_AXIS_LABEL, row[1]);
      }
    }
  }