예제 #1
0
  private void dimensionConfigChanged(DimensionConfigChangeEvent dimensionChange) {
    PlotConfiguration currentPlotConfig =
        plotInstance.getCurrentPlotConfigurationClone(); // get current plot configuration

    // if domain config has changed
    if (dimensionChange.getDimension() == PlotDimension.DOMAIN) {
      getDomainConfigManagerData()
          .dimensionConfigChanged(dimensionChange); // inform domain config data

      // also inform both domain dimension configs
      DomainConfigManager domainConfigManager = currentPlotConfig.getDomainConfigManager();
      getDimensionConfigData(domainConfigManager.getDomainConfig(false))
          .dimensionConfigChanged(dimensionChange);
      getDimensionConfigData(domainConfigManager.getDomainConfig(true))
          .dimensionConfigChanged(dimensionChange);

    } else {
      // inform default dimension config data about change

      int id = dimensionChange.getSource().getId(); // fetch id of changed dimension
      DimensionConfig currentDimensionConfig =
          currentPlotConfig.getDefaultDimensionConfigById(id); // look up dimension config

      // if dimension config is still present, inform data about changes
      if (currentDimensionConfig != null) {
        DimensionConfigData dimData =
            getDimensionConfigData((DefaultDimensionConfig) currentDimensionConfig);
        dimData.dimensionConfigChanged(dimensionChange);
      } else {
        // if current dimension config is null it has been deleted afterwards in a meta change event
        debug(
            "#### CAUTION #### DIMENSION CHANGED:  current dimension config "
                + dimensionChange.getSource().getLabel()
                + " with id "
                + dimensionChange.getSource().getId()
                + " is null! Meta change event?");
        return; // do nothing and return
      }
    }

    // and process event here too
    if (dimensionChange.getType() == DimensionConfigChangeType.RANGE) {
      clearCache();
    }
  }
예제 #2
0
  public List<PlotConfigurationError> getErrors() {
    List<PlotConfigurationError> errors = new LinkedList<PlotConfigurationError>();

    for (ValueSourceData valueSourceData : getValueSourcesData()) {
      errors.addAll(valueSourceData.getErrors());
    }

    for (DimensionConfigData data : dimensionConfigDataMap.values()) {
      if (data.getDimensionConfig().getDimension() == PlotDimension.DOMAIN) {
        continue;
      } else {
        List<PlotConfigurationError> error = data.getErrors();
        errors.addAll(error);
      }
    }

    // check domain dimension for errors depending on grouping state
    DomainConfigManager domainConfigManager =
        plotInstance.getCurrentPlotConfigurationClone().getDomainConfigManager();
    GroupingState groupingState = domainConfigManager.getGroupingState();
    switch (groupingState) {
      case GROUPED:
        errors.addAll(
            getDimensionConfigData(domainConfigManager.getDomainConfig(true)).getErrors());
        break;
      case PARTIALLY_GROUPED:
        errors.addAll(
            getDimensionConfigData(domainConfigManager.getDomainConfig(true)).getErrors());
        errors.addAll(
            getDimensionConfigData(domainConfigManager.getDomainConfig(false)).getErrors());
        break;
      case UNGROUPED:
        errors.addAll(
            getDimensionConfigData(domainConfigManager.getDomainConfig(false)).getErrors());
        break;
    }

    for (RangeAxisData data : rangeAxisDataMap.values()) {
      errors.addAll(data.getErrors());
    }

    errors.addAll(domainConfigManagerData.getErrors());

    return errors;
  }