예제 #1
0
  /**
   * Updates the filters of the filteredDataTableView so that the data is filtered by the user
   * defined ranges (if applicable) of the {@link DimensionConfig}s.
   */
  private void updateFilteredDataTable() {
    cachedSampledDataTable = null;
    List<ValueRange> dimensionRanges = new LinkedList<ValueRange>();
    for (PlotDimension dimension : PlotDimension.values()) {
      DimensionConfig dimConf =
          plotInstance.getCurrentPlotConfigurationClone().getDimensionConfig(dimension);
      if (dimConf != null) {
        if (dimConf.isUsingUserDefinedLowerBound() || dimConf.isUsingUserDefinedUpperBound()) {
          ValueRange dimensionRange =
              dimConf.getUserDefinedRangeClone(filteredDataTableView.getParentTable());
          if (dimensionRange instanceof NumericalValueRange) {
            NumericalValueRange numericalDimensionRange = (NumericalValueRange) dimensionRange;
            if (!dimConf.isUsingUserDefinedLowerBound()) {
              numericalDimensionRange.setLowerBound(Double.NEGATIVE_INFINITY);
            }
            if (!dimConf.isUsingUserDefinedUpperBound()) {
              numericalDimensionRange.setUpperBound(Double.POSITIVE_INFINITY);
            }
          }
          if (dimensionRange != null) {
            dimensionRanges.add(dimensionRange);
          }
        }
      }
    }

    filteredDataTableView.replaceConditions(dimensionRanges);

    dataTableIsValid = true;
  }
예제 #2
0
  @Override
  public synchronized boolean plotConfigurationChanged(PlotConfigurationChangeEvent change) {
    if (change == null || change == lastProcessedEvent) {
      return true;
    }
    lastProcessedEvent = change;

    PlotConfiguration currentPlotConfig =
        plotInstance.getCurrentPlotConfigurationClone(); // get current plot config

    // prepare temp variables
    int id = -1;
    DimensionConfig currentDimensionConfig = null;
    RangeAxisConfig currentRangeAxis = null;

    DimensionConfig changeDimensionConfig = change.getDimensionConfig();
    if (changeDimensionConfig != null) {
      // if event is a dimension config add/remove event, get current dimension config
      // (may be null if meta event is processed and it has been deleted afterwards)
      id = changeDimensionConfig.getId();
      currentDimensionConfig = currentPlotConfig.getDefaultDimensionConfigById(id);
    }

    RangeAxisConfig changeRangeAxis = change.getRangeAxisConfig();
    if (changeRangeAxis != null) {
      // if event is a range axis config add/remove event, get current range axis config
      // (may be null if meta event is processed and it has been deleted afterwards)
      id = changeRangeAxis.getId();
      currentRangeAxis = currentPlotConfig.getRangeAxisConfigById(id);
    }

    switch (change.getType()) {
      case TRIGGER_REPLOT:
        clearCache();
        break;
      case AXES_FONT:
        break;
      case AXIS_LINE_COLOR:
        break;
      case AXIS_LINE_WIDTH:
        break;
      case FRAME_BACKGROUND_COLOR:
        break;
      case CHART_TITLE:
        break;
      case COLOR_SCHEME:
        break;
      case DATA_TABLE_EXCHANGED:
        break;
      case DIMENSION_CONFIG_ADDED:
        // if current plot configuration still contains item..
        if (currentDimensionConfig != null && id != -1) {
          // add new dimension config data to map
          dimensionConfigDataMap.put(
              id,
              new DimensionConfigData(
                  plotInstance, (DefaultDimensionConfig) currentDimensionConfig));
          debug(
              "ADDED dimension "
                  + currentDimensionConfig.getDimension().getName()
                  + " ## ID: "
                  + id);
          clearCache();
        } else {
          debug(
              "#### CAUTION ###### ADD DIMENSION CONFIG: CURRENT DIMENSIONCONFIG "
                  + changeDimensionConfig.getLabel()
                  + " with id "
                  + changeDimensionConfig.getId()
                  + " IS NULL! Processing meta event?");
        }
        break;
      case DIMENSION_CONFIG_CHANGED:
        dimensionConfigChanged(change.getDimensionChange());
        break;
      case DIMENSION_CONFIG_REMOVED:
        debug(
            "REMOVED dimension "
                + changeDimensionConfig.getDimension().getName()
                + " ## ID: "
                + changeDimensionConfig.getId());
        dimensionConfigDataMap.remove(
            changeDimensionConfig.getId()); // remove dimension config data from map
        clearCache();
        break;
      case LEGEND_CHANGED:
        break;
      case PLOT_BACKGROUND_COLOR:
        break;
      case PLOT_ORIENTATION:
        break;
      case RANGE_AXIS_CONFIG_ADDED:
        // if current plot configuration still contains item..
        if (currentRangeAxis != null && id != -1) {
          // add new range axis data to map
          debug("range axis ADDED - " + currentRangeAxis.getLabel() + " ## ID: " + id);
          rangeAxisDataMap.put(id, new RangeAxisData(currentRangeAxis, plotInstance));
          for (ValueSource valueSource :
              currentRangeAxis.getValueSources()) { // also add containing value sources data to map
            debug(
                "value source ADDED - "
                    + valueSource.getLabel()
                    + " ## ID: "
                    + valueSource.getId());
            valueSourceDataMap.put(
                valueSource.getId(), new ValueSourceData(valueSource, plotInstance));
          }
        } else {
          debug(
              "#### CAUTION ###### ADD RANGE AXIS CONFIG: CURRENT RANGEAXISCONFIG "
                  + changeRangeAxis.getLabel()
                  + " with id "
                  + changeRangeAxis.getId()
                  + " IS NULL! Processing meta event?");
        }
        break;
      case RANGE_AXIS_CONFIG_CHANGED:
        RangeAxisConfigChangeEvent rangeAxisConfigChange = change.getRangeAxisConfigChange();
        debug(
            "range axis CHANGED - "
                + rangeAxisConfigChange.getSource().getLabel()
                + " ## ID: "
                + rangeAxisConfigChange.getSource().getId());
        rangeAxisConfigChanged(rangeAxisConfigChange);
        break;
      case RANGE_AXIS_CONFIG_MOVED:
        break;
      case RANGE_AXIS_CONFIG_REMOVED:
        RangeAxisConfig rangeAxis = change.getRangeAxisConfig();
        debug("range axis REMOVED - " + rangeAxis.getLabel() + " ## ID: " + rangeAxis.getId());
        rangeAxisDataMap.remove(rangeAxis.getId()); // remove range axis config from map
        for (ValueSource valueSource :
            rangeAxis.getValueSources()) { // also remove all containing value sources from data map
          valueSourceDataMap.remove(valueSource.getId());
        }
        clearCache();
        break;
      case LINK_AND_BRUSH_SELECTION:
        break;
      case META_CHANGE:
        for (PlotConfigurationChangeEvent e : change.getPlotConfigChangeEvents()) {
          plotConfigurationChanged(e);
        }
        break;
    }

    return true;
  }