예제 #1
0
  /*
   * (non-Javadoc)
   *
   * @seeorg.eclipse.birt.chart.ui.swt.interfaces.ISeriesUIProvider#
   * validateAggregationType (org.eclipse.birt.chart.model.component.Series,
   * org.eclipse.birt.chart.model.data.SeriesDefinition,
   * org.eclipse.birt.chart.model.data.SeriesDefinition)
   */
  public boolean isValidAggregationType(
      Series series, SeriesDefinition orthSD, SeriesDefinition baseSD) {
    boolean isValidAgg = true;
    EList<Query> queries = series.getDataDefinition();
    for (int i : validationIndex(series)) {
      if (!isValidAgg) {
        break;
      }
      Query query = queries.get(i);
      boolean checked = false;
      String id =
          ChartWizard.Gatt_aggCheck_ID
              + series.eContainer().hashCode()
              + series.getDataDefinition().indexOf(query);
      ChartWizard.removeException(id);
      if (query.getGrouping() != null && query.getGrouping().isEnabled()) {
        checked = true;
        isValidAgg = isValidAggregation(query.getGrouping(), false, id);
      }

      if (!checked && orthSD.getGrouping() != null && orthSD.getGrouping().isEnabled()) {
        checked = true;
        isValidAgg = isValidAggregation(orthSD.getGrouping(), false, id);
      }

      if (!checked) {

        if (baseSD.getGrouping() != null && baseSD.getGrouping().isEnabled()) {
          isValidAgg = isValidAggregation(baseSD.getGrouping(), true, id);
        }
      }
    }
    return isValidAgg;
  }
예제 #2
0
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.birt.chart.ui.swt.DefaultSeriesUIProvider#validateSeriesBindingType(org.eclipse.birt.chart.model.component.Series,
   *      org.eclipse.birt.chart.ui.swt.interfaces.IDataServiceProvider)
   */
  public void validateSeriesBindingType(Series series, IDataServiceProvider idsp)
      throws ChartException {
    ArrayList<Query> al = new ArrayList<Query>();
    al.addAll(series.getDataDefinition());
    for (int i = 0; i < al.size(); i++) {
      Query query = al.get(i);
      DataType dataType = idsp.getDataType(query.getDefinition());

      if ((i != 2) && (dataType == DataType.TEXT_LITERAL || dataType == DataType.NUMERIC_LITERAL)) {
        final ExpressionCodec codec = ChartModelHelper.instance().createExpressionCodec();
        codec.decode(query.getDefinition());
        throw new ChartException(
            ChartUIExtensionPlugin.ID, ChartException.DATA_BINDING, codec.getExpression());
      }
    }
  }