Пример #1
0
 /** {@inheritDoc} */
 @Override
 public CellUpdater basicGetUpdater() {
   CellUpdater updater = null;
   DColumn dColumn = getColumn();
   if (dColumn != null) {
     ColumnMapping originMapping = dColumn.getOriginMapping();
     if (originMapping instanceof CellUpdater) {
       updater = (CellUpdater) originMapping;
     }
   }
   IntersectionMapping intersectMapping = getIntersectionMapping();
   if (intersectMapping != null) {
     updater = intersectMapping;
   }
   return updater;
 }
 // CHECKSTYLE:OFF
 @SuppressWarnings("unchecked")
 private void analyseNotification(Notification notification) {
   Object notifier = notification.getNotifier();
   if (notifier instanceof DTable) {
     if (notification.getFeature() == TablePackage.Literals.DTABLE__HEADER_COLUMN_WIDTH) {
       updateHeaderColumnWidth = true;
     } else if (notification.getFeature() == TablePackage.Literals.DTABLE__COLUMNS) {
       // The position is incremented by one cause of the header column
       if (notification.getEventType() == Notification.ADD) {
         if (notification.getNewValue() instanceof DColumn) {
           dColumnsToAdd.put((DColumn) notification.getNewValue(), notification.getPosition() + 1);
         }
       } else if (notification.getEventType() == Notification.MOVE) {
         if (notification.getNewValue() instanceof DColumn) {
           DColumn newValue = (DColumn) notification.getNewValue();
           int newPosition = notification.getPosition() + 1;
           dColumnsToAdd.put(newValue, newPosition);
           dColumnsToRemove.add(newValue);
         }
       } else if (notification.getEventType() == Notification.REMOVE) {
         if (notification.getOldValue() instanceof DColumn) {
           dColumnsToRemove.add((DColumn) notification.getOldValue());
         }
       } else if (notification.getEventType() == Notification.REMOVE_MANY
           && notification.getOldValue() instanceof EList) {
         for (final EObject oldValue : (EList<EObject>) notification.getOldValue()) {
           if (oldValue instanceof DTargetColumn) {
             dColumnsToRemove.add((DColumn) oldValue);
           }
         }
       }
     } else if (notification.getFeature() == ViewpointPackage.Literals.DSEMANTIC_DECORATOR__TARGET
         || notification.getFeature() == TablePackage.Literals.LINE_CONTAINER__LINES) {
       toRefreshInViewerWithUpdateLabels.add(notifier);
     }
   } else if (notifier instanceof DLine) {
     DLine dLine = (DLine) notifier;
     if (notification.getFeature() == TablePackage.Literals.DLINE__LABEL
         || notification.getFeature() == TablePackage.Literals.DLINE__CELLS
         || notification.getFeature() == TablePackage.Literals.DLINE__CURRENT_STYLE) {
       toUpdateInViewer.add(notifier);
     } else if (notification.getFeature() == TablePackage.Literals.DLINE__ORDERED_CELLS) {
       toRefreshInViewerWithUpdateLabels.add(notifier);
     } else if (notification.getFeature() == TablePackage.Literals.LINE_CONTAINER__LINES) {
       toRefreshInViewerWithUpdateLabels.add(notifier);
       // By default created DLine is expand of default value of
       // DLine.collapsed is false
       if (!dLine.isCollapsed()) {
         toExpands.add(dLine);
         analyseExpansionStateOfCreatedChildren(dLine.getLines());
       }
     } else if (notification.getFeature() == TablePackage.Literals.DLINE__VISIBLE) {
       launchGlobalRefreshWithoutUpdateLabels = true;
     } else if (notification.getFeature() == TablePackage.Literals.DLINE__COLLAPSED) {
       analyseExpansion(dLine);
     }
   } else if (notifier instanceof DColumn) {
     DColumn dColumn = (DColumn) notifier;
     if (notification.getFeature() == TablePackage.Literals.DCOLUMN__ORDERED_CELLS) {
       launchGlobalRefreshWithUpdateLabels = true;
     } else if (notification.getFeature() == TablePackage.Literals.DCOLUMN__LABEL) {
       dColumnsToUpdateDirectly.add(dColumn);
     } else if (notification.getFeature() == TablePackage.Literals.DCOLUMN__VISIBLE) {
       dColumnsToVisibilityChanged.put(dColumn, dColumn.isVisible());
     } else if (notification.getFeature() == TablePackage.Literals.DCOLUMN__WIDTH) {
       dColumnsWidthToUpdate.add(dColumn);
     }
   } else if (notification.getFeature() == TablePackage.Literals.DCELL__LABEL
       || notification.getFeature() == TablePackage.Literals.DCELL__CURRENT_STYLE
           && notifier instanceof DCell) {
     DCell dCell = (DCell) notifier;
     DLine dLine = dCell.getLine();
     if (dLine != null) {
       toUpdateInViewer.add(dLine);
     }
   } else if (isDTableElementStyleAttributeChange(notification)) {
     DTableElementStyle dTableElementStyle = (DTableElementStyle) notifier;
     EObject eContainer = dTableElementStyle.eContainer();
     if (eContainer instanceof DCell) {
       DCell dCell = (DCell) eContainer;
       DLine dLine = dCell.getLine();
       toUpdateInViewer.add(dLine);
     } else if (eContainer instanceof DLine) {
       toUpdateInViewer.add(eContainer);
     } else if (eContainer instanceof DColumn) {
       DColumn dColumn = (DColumn) eContainer;
       toRefreshInViewerWithUpdateLabels.add(dColumn.getTable());
     }
   } else if (notification.getNotifier() instanceof DCellStyle
       && isRGBValuesChange(notification)) {
     DCellStyle dCellStyle = (DCellStyle) notification.getNotifier();
     EObject dCellStyleContainer = dCellStyle.eContainer();
     if (dCellStyleContainer instanceof DCell) {
       DCell dCell = (DCell) dCellStyleContainer;
       DLine dLine = dCell.getLine();
       if (dLine != null) {
         toUpdateInViewer.add(dLine);
       }
     }
   }
 }