Exemplo n.º 1
0
  private boolean processor(List ori, List newList, List nullLevelHandle, boolean doChange)
      throws SemanticException {
    boolean isLevelRemoved = false;
    for (int i = nullLevelHandle.size() - 1; i >= 0; i--) {
      int index = ((Integer) nullLevelHandle.get(i)).intValue();
      if (doChange) {
        viewHandle.removeLevel(index);
      }
      isLevelRemoved = true;
    }

    for (int i = 0; i < ori.size(); i++) {
      LevelHandle tempHandle = (LevelHandle) ori.get(i);
      if (!newList.contains(tempHandle)) {
        if (doChange) {
          viewHandle.removeLevel(tempHandle.getQualifiedName());
        }
        isLevelRemoved = true;
      }
    }

    Collections.sort(newList, new LevelComparator());
    if (doChange) {
      for (int i = 0; i < newList.size(); i++) {
        LevelHandle tempHandle = (LevelHandle) newList.get(i);
        if (viewHandle.getLevel(tempHandle.getQualifiedName()) == null) {
          insertLevelHandle(tempHandle, i);
        }
      }
    }
    return isLevelRemoved;
  }
  private CrosstabCellHandle getSubTotalMeasureHeaderCell(
      int axis, int dimensionIndex, int levelIndex, int measureIndex) {
    if (measureIndex >= 0
        && measureIndex < totalMeasureCount
        && dimensionIndex >= 0
        && levelIndex >= 0) {
      DimensionViewHandle dv = crosstabItem.getDimension(axis, dimensionIndex);
      LevelViewHandle lv = dv.getLevel(levelIndex);

      return crosstabItem.getMeasure(measureIndex).getHeader(lv);
    }

    return null;
  }
Exemplo n.º 3
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();
  }
Exemplo n.º 4
0
  public boolean isEnabled() {

    return !DEUtil.isReferenceElement(viewHandle.getCrosstabHandle())
        && findDimension(
                CrosstabAdaptUtil.getLevelViewHandle(
                        CrosstabAdaptUtil.getExtendedItemHandle(getHandle()))
                    .getCubeLevel())
            != null;
  }
Exemplo n.º 5
0
  private void insertLevelHandle(LevelHandle levelHandle, int pos) throws SemanticException {

    CrosstabReportItemHandle reportHandle = viewHandle.getCrosstab();
    // int viewCount = viewHandle.getLevelCount( );

    DataItemHandle dataHandle =
        CrosstabAdaptUtil.createColumnBindingAndDataItem(
            (ExtendedItemHandle) reportHandle.getModelHandle(), levelHandle);

    LevelViewHandle levelViewHandle = viewHandle.insertLevel(levelHandle, pos);
    CrosstabCellHandle cellHandle = levelViewHandle.getCell();

    cellHandle.addContent(dataHandle);

    ActionHandle actionHandle = levelHandle.getActionHandle();
    if (actionHandle != null) {
      List source = new ArrayList();
      source.add(actionHandle.getStructure());
      List newAction = ModelUtil.cloneStructList(source);
      dataHandle.setAction((Action) newAction.get(0));
    }

    CrosstabUtil.addLabelToHeader(levelViewHandle);
  }
 protected List getChildrenList(Object parent) {
   if (parent instanceof TabularDimensionHandle) {
     List children = new ArrayList();
     try {
       TabularDimensionHandle handle = (TabularDimensionHandle) parent;
       CrosstabReportItemHandle xtabHandle = getCrosstabReportItemHandle();
       for (int i = 0; i < xtabHandle.getDimensionCount(ICrosstabConstants.ROW_AXIS_TYPE); i++) {
         DimensionViewHandle dimensionHandle =
             xtabHandle.getDimension(ICrosstabConstants.ROW_AXIS_TYPE, i);
         if (dimensionHandle.getCubeDimension().equals(handle))
           children.add(dimensionHandle.getLevel(0).getCubeLevel());
       }
       for (int i = 0;
           i < xtabHandle.getDimensionCount(ICrosstabConstants.COLUMN_AXIS_TYPE);
           i++) {
         DimensionViewHandle dimensionHandle =
             xtabHandle.getDimension(ICrosstabConstants.COLUMN_AXIS_TYPE, i);
         if (dimensionHandle.getCubeDimension().equals(handle))
           children.add(dimensionHandle.getLevel(0).getCubeLevel());
       }
     } catch (ExtendedElementException e) {
     }
     return children;
   } else if (parent instanceof LevelHandle) {
     List children = new ArrayList();
     LevelHandle levelHandle = (LevelHandle) parent;
     try {
       CrosstabReportItemHandle xtabHandle = getCrosstabReportItemHandle();
       for (int i = 0; i < xtabHandle.getDimensionCount(ICrosstabConstants.ROW_AXIS_TYPE); i++) {
         DimensionViewHandle dimensionHandle =
             xtabHandle.getDimension(ICrosstabConstants.ROW_AXIS_TYPE, i);
         LevelViewHandle levelViewHandle =
             dimensionHandle.getLevel(levelHandle.getQualifiedName());
         if (levelViewHandle != null)
           if (dimensionHandle.getLevelCount() > levelViewHandle.getIndex() + 1)
             children.add(dimensionHandle.getLevel(levelViewHandle.getIndex() + 1).getCubeLevel());
       }
       for (int i = 0;
           i < xtabHandle.getDimensionCount(ICrosstabConstants.COLUMN_AXIS_TYPE);
           i++) {
         DimensionViewHandle dimensionHandle =
             xtabHandle.getDimension(ICrosstabConstants.COLUMN_AXIS_TYPE, i);
         LevelViewHandle levelViewHandle =
             dimensionHandle.getLevel(levelHandle.getQualifiedName());
         if (levelViewHandle != null)
           if (dimensionHandle.getLevelCount() > levelViewHandle.getIndex() + 1)
             children.add(dimensionHandle.getLevel(levelViewHandle.getIndex() + 1).getCubeLevel());
       }
     } catch (ExtendedElementException e) {
     }
     return children;
   }
   return super.getChildrenList(parent);
 }