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]);
      }
    }
  }
Example #2
0
 /**
  * @param stripChartPart
  * @throws WrongADLFormatException
  */
 private void plotcom(ADLWidget stripChartPart) throws WrongADLFormatException {
   for (FileLine fileLine : stripChartPart.getBody()) {
     String stripChart = fileLine.getLine();
     String[] row = stripChart.split("=");
     if (row.length != 2) {
       throw new WrongADLFormatException(Messages.Bargraph_1);
     }
     String parameter = row[0].trim();
     /** period=30.000000 units="minute" */
     if (parameter.equals("title")) {
       String name = row[1].replaceAll("\"", "").trim();
       _widget.setPropertyValue(AbstractChartModel.PROP_LABEL, name);
     } else if (parameter.equals("clr")) {
       _widget.setColor(AbstractWidgetModel.PROP_COLOR_FOREGROUND, ADLHelper.getRGB(row[1]));
     } else if (parameter.equals("bclr")) {
       _widget.setColor(AbstractWidgetModel.PROP_COLOR_BACKGROUND, ADLHelper.getRGB(row[1]));
     } else if (parameter.equals("xlabel")) {
       String xLabel = row[1].replaceAll("\"", "").trim();
       _widget.setPropertyValue(AbstractChartModel.PROP_X_AXIS_LABEL, xLabel);
     } else if (parameter.equals("ylabel")) {
       String yLabel = row[1].replaceAll("\"", "").trim();
       _widget.setPropertyValue(AbstractChartModel.PROP_Y_AXIS_LABEL, yLabel);
     } else {
       LOG.info("Unknown StripChart {} parameter: {}", stripChartPart.getType(), fileLine);
     }
   }
 }
Example #3
0
  /**
   * @param stripChartPart
   * @throws WrongADLFormatException
   */
  private void pen(ADLWidget stripChartPart) throws WrongADLFormatException {
    int start = stripChartPart.getType().indexOf("[");
    int end = stripChartPart.getType().indexOf("]");
    String id = stripChartPart.getType().substring(start + 1, end);
    int index = Integer.parseInt(id);

    for (FileLine fileLine : stripChartPart.getBody()) {
      String stripChart = fileLine.getLine();
      String[] row = stripChart.split("=");
      if (row.length != 2) {
        throw new WrongADLFormatException(Messages.Bargraph_1);
      }
      String parameter = row[0].trim();
      /** chan="$(epn_ai)" utilChan="$(epn_ai)_h" clr=62 */
      if (parameter.equals("chan")) {
        DebugHelper.add(this, row[1]);
        row = ADLHelper.cleanString(row[1]);
        if (index == 0) {
          _widget.setPrimarPv(row[1]);
        }
        _widget.setPropertyValue(StripChartModel.enablePlotPropertyId(index), true);
        DynamicsDescriptor dynamicsDescriptor = new DynamicsDescriptor();
        //                FIXME: Parameter was String[].class
        @SuppressWarnings("restriction")
        ParameterDescriptor parameterDescriptor = new ParameterDescriptor(row[1], "");
        dynamicsDescriptor.addInputChannel(parameterDescriptor);
        _widget.setPropertyValue(StripChartModel.valuePropertyId(index), index);
        _widget.setDynamicsDescriptor(StripChartModel.valuePropertyId(index), dynamicsDescriptor);
      } else if (parameter.equals("utilChan")) {
        // not used in SDS
      } else if (parameter.equals("clr")) {
        _widget.setPropertyValue(
            AbstractChartModel.plotColorPropertyId(index), ADLHelper.getRGB(row[1]));
      } else {
        LOG.info("Unknown StripChart {} parameter: {}", stripChartPart.getType(), fileLine);
      }
    }
  }