예제 #1
0
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.action.Action#run()
   */
  public void run() {
    transStar(NAME);
    try {
      LevelViewDialog dialog = new LevelViewDialog(true);
      List showLevels = new ArrayList();
      List nullLevelHandle = new ArrayList();
      int viewCount = viewHandle.getLevelCount();
      for (int i = 0; i < viewCount; i++) {
        LevelViewHandle levelHandle = viewHandle.getLevel(i);
        if (levelHandle.getCubeLevel() == null) {
          nullLevelHandle.add(Integer.valueOf(levelHandle.getIndex()));
        } else {
          showLevels.add(levelHandle.getCubeLevel());
        }
      }

      ExtendedItemHandle extendedHandle = CrosstabAdaptUtil.getExtendedItemHandle(getHandle());
      LevelViewHandle levelViewHandle = CrosstabAdaptUtil.getLevelViewHandle(extendedHandle);

      dialog.setInput(findDimension(levelViewHandle.getCubeLevel()), showLevels);
      if (dialog.open() == Window.OK) {
        CrosstabReportItemHandle reportHandle = viewHandle.getCrosstab();

        List result = (List) dialog.getResult();
        boolean isLevelRemoved = processor(showLevels, result, nullLevelHandle, false);

        if (isLevelRemoved) {
          boolean bool = CrosstabAdaptUtil.needRemoveInvaildBindings(reportHandle);
          processor(showLevels, result, nullLevelHandle, true);
          if (bool) {
            CrosstabAdaptUtil.removeInvalidBindings(reportHandle);
          }
        } else {
          processor(showLevels, result, nullLevelHandle, true);
        }

        AggregationCellProviderWrapper providerWrapper =
            new AggregationCellProviderWrapper(reportHandle);
        providerWrapper.updateAllAggregationCells(AggregationCellViewAdapter.SWITCH_VIEW_TYPE);
      }
    } catch (SemanticException e) {
      rollBack();
      ExceptionUtil.handle(e);
      return;
    }
    transEnd();
  }
예제 #2
0
  private void initializeItems(MeasureInfo measureInfo) {
    List<String> viewNameList = new ArrayList<String>();
    List<String> itemList = new ArrayList<String>();

    MeasureViewHandle measureView = crosstab.getMeasure(measureInfo.getMeasureName());
    if (measureView != null && measureView instanceof ComputedMeasureViewHandle) {
      itemList.add("");
      viewNameList.add(""); // $NON-NLS-1$
    } else
    // NOT ComputedMeasureViewHandle -- begin --
    {
      AggregationCellHandle cell = getAggregationCell(measureInfo);
      if (cell != null && cellProviderWrapper.getMatchProvider(cell) == null) {
        itemList.add("");
        viewNameList.add(""); // $NON-NLS-1$
      }

      IAggregationCellViewProvider providers[] = cellProviderWrapper.getAllProviders();
      for (int i = 0; i < providers.length; i++) {
        IAggregationCellViewProvider tmp = (IAggregationCellViewProvider) providers[i];
        if (tmp == null) {
          continue;
        }
        SwitchCellInfo info = new SwitchCellInfo(crosstab, SwitchCellInfo.MEASURE);
        info.setMeasureInfo(measureInfo);

        if (!providers[i].canSwitch(info)) {
          continue;
        }

        String displayName = tmp.getViewDisplayName();
        viewNameList.add(tmp.getViewName());
        itemList.add(
            Messages.getString(
                "GrandTotalProvider.ShowAs", //$NON-NLS-1$
                new String[] {displayName}));
      }
    } // NOT ComputedMeasureViewHandle -- end --
    comboItems = (String[]) itemList.toArray(new String[itemList.size()]);
    viewNames = (String[]) viewNameList.toArray(new String[viewNameList.size()]);
  }