コード例 #1
0
  private void rangeAxisConfigChanged(RangeAxisConfigChangeEvent rangeAxisConfigChange) {

    PlotConfiguration currentPlotConfig =
        plotInstance.getCurrentPlotConfigurationClone(); // get current plot config
    int id = rangeAxisConfigChange.getSource().getId(); // fetch id
    RangeAxisConfig currentRangeAxisConfig =
        currentPlotConfig.getRangeAxisConfigById(id); // look up range axis config

    if (currentRangeAxisConfig == null) {
      // if current range axis config is null it has been deleted afterwards in a meta change event
      debug(
          "#### CAUTION #### RANGE AXIS CONFIG CHANGE: current range axis config "
              + rangeAxisConfigChange.getSource().getLabel()
              + " with id "
              + rangeAxisConfigChange.getSource().getId()
              + " is null! Meta change event?");
      return;
    }

    // inform range axis data
    RangeAxisData rangeAxisData = getRangeAxisData(currentRangeAxisConfig);
    rangeAxisData.rangeAxisConfigChanged(rangeAxisConfigChange);

    // and also process event here
    ValueSource changeValueSource = rangeAxisConfigChange.getValueSource();
    ValueSource currentValueSource = null;
    if (changeValueSource != null) {
      id = changeValueSource.getId(); // fetch id from value source add/remove event
      currentValueSource =
          currentRangeAxisConfig.getValueSourceById(id); // look up current value source
    }
    //		else {
    //			return; // nothing to be done
    //		}

    switch (rangeAxisConfigChange.getType()) {
      case VALUE_SOURCE_ADDED:
        if (currentValueSource != null) {
          debug(
              "value source ADDED - "
                  + currentValueSource.getLabel()
                  + " ## ID: "
                  + currentValueSource.getId());
          valueSourceDataMap.put(
              currentValueSource.getId(), new ValueSourceData(currentValueSource, plotInstance));
          clearCache();
        } else {
          // if current value source is null it has been deleted afterwards in a meta change event
          debug(
              "#### CAUTION #### VALUE SOURCE ADDED: current value source"
                  + changeValueSource.getLabel()
                  + " with id "
                  + changeValueSource.getId()
                  + " is null! Meta change event?");
          return; // nothing to be done
        }
        break;
      case VALUE_SOURCE_CHANGED:
        ValueSourceChangeEvent valueSourceChange = rangeAxisConfigChange.getValueSourceChange();
        changeValueSource = valueSourceChange.getSource(); // get source
        id = changeValueSource.getId(); // fetch id from changed value source
        currentValueSource =
            currentRangeAxisConfig.getValueSourceById(id); // look up current value source

        if (currentValueSource != null) {
          debug("value source CHANGED - " + currentValueSource.getLabel() + " ## ID: " + id);
          getValueSourceData(currentValueSource)
              .valueSourceChanged(valueSourceChange, currentValueSource);
        } else {
          // if current value source is null it has been deleted afterwards in a meta change event
          debug(
              "#### CAUTION #### VALUE SOURCE CHANGED: current value source"
                  + changeValueSource.getLabel()
                  + " with id "
                  + changeValueSource.getId()
                  + " is null! Meta change event?");
          return; // nothing to be done
        }
        break;
      case VALUE_SOURCE_REMOVED:
        debug(
            "value source REMOVED - "
                + changeValueSource.getLabel()
                + " ## ID: "
                + changeValueSource.getId());
        valueSourceDataMap.remove(changeValueSource.getId());
        clearCache();
        break;
    }
  }